Skip to content

feat: in-app text preview - #147

Merged
nextestudios merged 2 commits into
mainfrom
feature/58-text-preview
Sep 27, 2026
Merged

nextestudios merged 2 commits into
mainfrom
feature/58-text-preview

Conversation

@nextestudios

Copy link
Copy Markdown
Owner

Summary

  • South on text files (.txt, .md, .log, .json, .xml, .csv, .ini, .yaml, source code…) opens a read-only preview; North → "Visualizar como texto" works on any other file, including scripts (.ps1, .bat) that South would ask to run. Reading never executes anything.
  • Bounded reading (TextPreview, Core): at most 2 MB and 10,000 lines are read/kept; larger files show a clear partial-preview notice. A multi-byte character cut by the byte limit is dropped instead of becoming U+FFFD.
  • Encoding detection: UTF-8 (with/without BOM), UTF-16 LE/BE (with BOM, or heuristically without), otherwise the Windows ANSI code page; the name is shown with the line count.
  • Binary refusal: NUL bytes outside UTF-16 or a high share of control characters → refused with a message.
  • Controller: Up/Down scroll a line, LT/RT a page (one line of context), LB/RB start/end, Left/Right shift long lines, South toggles fixed-width/proportional font, East/B closes and keeps focus on the file. Only the visible lines are rendered (≤ 400 columns each), with line numbers.
  • Files inside archives are not previewed (documented).

Tests

  • CI (unit): encoding detection per path (UTF-8, BOM, UTF-16 with/without BOM, ANSI), binary refusal, byte and line limits with the notice and the cut multi-byte character; journey: South opens the preview, scroll/page/end clamp, horizontal shift, font toggle, file untouched, Back restores focus, a binary file from the menu is refused.
  • Manual (added to docs/TESTING.md): huge log responsiveness, real Notepad encodings, long lines at TV distance and 4K, Narrator.

Closes #58

🤖 Generated with Claude Code

nextestudios and others added 2 commits September 27, 2026 02:07
South on text files (or North > View as text on any file) opens a
read-only preview. Encoding is detected (UTF-8 with/without BOM,
UTF-16 with/without BOM, ANSI fallback), at most 2 MB / 10,000 lines
are read with a partial-preview notice, and binary files are refused.
Scroll, page and jump with the controller; fixed/proportional font.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nextestudios
nextestudios force-pushed the feature/58-text-preview branch from dca922d to 89baf46 Compare September 27, 2026 05:07
@nextestudios
nextestudios merged commit b47f8dd into main Sep 27, 2026
1 check passed
@nextestudios
nextestudios deleted the feature/58-text-preview branch September 27, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add in-app text preview

1 participant