Skip to content

fix(tmux): reset captured SGR before live output resumes - #632

Merged
Ark0N merged 1 commit into
Ark0N:masterfrom
ludovicfourrage:fix/capture-pane-sgr-reset-629
Oct 16, 2026
Merged

Ark0N merged 1 commit into
Ark0N:masterfrom
ludovicfourrage:fix/capture-pane-sgr-reset-629

Conversation

@ludovicfourrage

Copy link
Copy Markdown
Contributor

Fixes #629.

Full-history pane captures can end with a nested tmux status bar's SGR still active, making later text and erase-to-end inherit its background. Reset SGR after replayed content and before cursor restoration. Apply the same reset to both raw-capture fallbacks, including the visible path identified in the issue reply. Empty captures retain the empty-string sentinel so callers keep their recorded history.

Adds unit tests exercising the real capturePaneBuffer with mocked tmux IO, plus a Chromium regression using the installed xterm.js. All three affected branches preserve the green status bar while subsequent text and erased cells use the default background. Registers the browser test in the dedicated runner.

Validation:

  • Before the fix: all three style unit assertions and all three browser cases failed for the missing reset / inherited background.
  • After the fix: 135 focused tests pass across five files; all three Chromium cases pass.
  • Typecheck, lint, scoped Prettier checks, browser-suite exclusion check, and git diff --check pass.
  • Fresh-eyes review completed; empty-capture edge case covered.

@Ark0N
Ark0N merged commit c5417ab into Ark0N:master Oct 16, 2026
Ark0N pushed a commit that referenced this pull request Oct 16, 2026
One release changeset for #616, #617, #621, #622, #623, #624, #625, #628, #632, #634, #635 and #642. The changesets carried by #616, #617 and #642 are folded into it and removed (#617's was minor; 1.41.2 is a patch release).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Ark0N

Ark0N commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Merged and shipped in 1.42.0, closing #629. Thanks @ludovicfourrage, and welcome as a first-time contributor!

A very precise first PR: the tests drive the real capturePaneBuffer and a real xterm, fail on master and pass with the fix, and you covered the visible-path fallback from the issue thread too. The PR's CI never ran (first-time contributor workflows wait for approval), so I ran every CI step on the branch here: typecheck, lint, format, the lockfile and browser-exclude checks, the unit tests and npm run test:browser -- test/tmux-capture-sgr.browser.test.ts, all green. I also checked the CLAUDE.md rule for full-history captures: the reset goes before the relative cursor move back to the caret, so the capture still ends the way the client expects.

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.

Full-history tmux snapshot leaves status-bar SGR active, coloring subsequent text and erased cells

2 participants