Skip to content

Port Windows Terminal fixes from upstream (serrebidev) - #5

Merged
ragb merged 2 commits into
masterfrom
port/terminal-fixes
Aug 24, 2026
Merged

ragb merged 2 commits into
masterfrom
port/terminal-fixes

Conversation

@ragb

@ragb ragb commented Aug 24, 2026 •

Copy link
Copy Markdown
Owner

Ports @serrebidev's Windows Terminal work from the old repo, where it was opened before maintenance moved here. Credited via Co-Authored-By on both commits.

On Windows 11, cmd/PowerShell/WSL run inside Windows Terminal, which exposes text through a UIA TermControl rather than the console buffer. control+NVDA+w only reached it by walking down from the foreground window, so it missed the active tab or split pane, and aborted with no output if currentClassName raised a COM error mid-walk.

The control is now located from the focused object, the class-name check is guarded, and captured text has trailing padding and border-only lines stripped.

Two things worth noting: ruifontes#18 predates ruifontes#16, so it only cleaned the two capture sites in obtainUWPWindowText() and not the focused-TermControl capture that is now the main path — applied there as well. The legacy ConsoleWindowClass branch keeps its raw .rstrip(), as upstream intended. Every conflict was formatting, not logic.

Partly addresses #3: the beep-then-stop in the command prompt is the COM failure now guarded. The PuTTY upward-scroll problem in that issue is separate.

Tested as a dev build in a running NVDA against Windows Terminal.

ragb and others added 2 commits August 24, 2026 15:48
Modern command-line windows (cmd, PowerShell, WSL under Windows Terminal)
expose their text through a UIA TermControl element rather than the legacy
console buffer. Detect that element from the focused object and capture from
it directly, so every tab and split pane works regardless of the host
window's class name.

Also guard currentClassName access, which can raise a COM error and
previously aborted the whole review command after the initial beep.

Ported from ruifontes#16.

Co-Authored-By: serrebidev <serrebi101@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Terminal cells are space-padded to the column width and TUI apps reserve
whole rows for borders and status chrome, so a UNIT_STORY capture fills the
review window with blank padding and box-drawing-only lines. Strip trailing
whitespace per line and drop lines with no real content.

Applied to the focused-TermControl capture as well, which the upstream PR
predates.

Ported from ruifontes#18.

Co-Authored-By: serrebidev <serrebi101@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant