Skip to content

Strip decorative padding and borders from terminal review text - #18

Closed
serrebidev wants to merge 1 commit into
ruifontes:masterfrom
serrebidev:clean-terminal-text
Closed

serrebidev wants to merge 1 commit into
ruifontes:masterfrom
serrebidev:clean-terminal-text

Conversation

@serrebidev

Copy link
Copy Markdown

What

Cleans up the text captured from a Windows Terminal TermControl before it is shown in the review window.

Why

Terminal cells are space-padded to the column width, and TUI apps (Claude Code, htop, editors, etc.) reserve whole rows and columns for borders and status chrome. Captured as a UNIT_STORY, the review fills with runs of blank padding and box-drawing-only lines. Navigating that line by line in the review window means paging past a lot of empty and border-only lines to reach the real content.

How

Adds _cleanTerminalText(), applied to both TermControl captures in obtainUWPWindowText():

  • strips per-line trailing whitespace, and
  • drops lines whose only non-whitespace characters are Unicode box-drawing glyphs (U+2500–U+257F).

Content lines that merely contain a border character (e.g. │ some text │) are preserved, because the letters and digits inside fall outside that range.

🤖 Generated with Claude Code

Terminal cells are space-padded to the column width and TUI apps reserve
whole rows/columns for borders and status chrome. Captured as a UNIT_STORY,
a Windows Terminal review fills with blank padding and box-drawing-only
lines that bury the real content when navigated line by line.

Add _cleanTerminalText(): strip per-line trailing whitespace and drop
lines whose only non-whitespace characters are Unicode box-drawing glyphs
(U+2500-U+257F). Content lines that merely contain a border character are
kept. Applied to both TermControl captures in obtainUWPWindowText().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serrebidev

Copy link
Copy Markdown
Author

This PR is the terminal text cleanup — stripping padding and border-only lines from captured terminal text.
Part of a three-PR set that splits a batch of Windows Terminal / command-line review improvements into independent, single-purpose changes. Each is branched off master and touches only addon/globalPlugins/virtualRevision.py, so they can be reviewed and merged in any order (or accepted/rejected independently):

Notes for review:

  • They edit the same file, so whichever merges first will leave the others needing a trivial rebase — happy to do that on request.
  • I deliberately left the addon_version / addon_changelog bump in buildVars.py out: it's date-based and yours to set at release, and three parallel branches would otherwise all conflict on that one line. Tell me the version you'd like and I'll add the changelog entry.
  • Verified on NVDA 2026.1 / Windows 11 (Windows Terminal running cmd, PowerShell and WSL, plus a legacy conhost console).

@ragb

ragb commented Aug 24, 2026

Copy link
Copy Markdown

Ported to ragb#5, where maintenance now continues. Credited via Co-Authored-By. Thanks @serrebidev.

@serrebidev

Copy link
Copy Markdown
Author

Ported with credit and merged in the maintained repository as ragb#5. The whitespace-padded border-row edge case found during live verification is addressed in ragb#8. Closing this obsolete PR in the old repository.

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.

2 participants