Skip to content

v1.5.1 - Improved text file detection

Choose a tag to compare

@kazu-42 kazu-42 released this 28 Feb 14:52
· 4 commits to main since this release

What's Changed

Improved text file detection (sidebar)

The sidebar now correctly identifies text files using a multi-stage content inspection algorithm, matching the approach used by content_inspector (the library powering bat):

  1. BOM detection — UTF-16/UTF-32 files with a Byte Order Mark are correctly recognized as text (previously could be misidentified as binary due to embedded NUL bytes)
  2. Magic bytes fast-reject — common binary formats (PNG, JPEG, GIF, PDF, ZIP, gzip, xz, bzip2, ELF, Mach-O, SQLite, RAR, 7-Zip, HDF5) are immediately blocked without needing a full content scan
  3. NUL byte scan — first 1024 bytes checked (up from 512); any NUL byte = binary

This fixes cases where files inside .git/ directories (e.g., HEAD, config, COMMIT_EDITMSG) and other extensionless text files could not be opened from the sidebar.

Full Changelog: v1.5.0...v1.5.1

Full Changelog: v1.5.0...v1.5.1