fix(remote): reset SGR at the remote scrollback splice seam (#602 merge-time fix)

joinScrollbackAndFrame joins two separate `capture-pane -e` outputs. The
remote history's last row can end with attributes still active (a diff row's
background, dim tool output), while the local frame is encoded relative to
the default state, so its first plain rows inherited them in the browser. A
`\x1b[0m` now ends the scrollback before the frame.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-13 18:01:45 +02:00
1 parent f9f00bdb5e
commit d571c41fb1
2 files changed
+12 -3

No files matched your search

+3 -1
View File
@@ -701,7 +701,9 @@ export function normalizeScrollbackEol(buffer: string): string {
*/
export function joinScrollbackAndFrame(scrollback: string | undefined, frame: string): string {
if (!scrollback) return frame;
return `${scrollback.replace(/\n$/, '')}\n${frame}`;
// Two separate captures: tmux encodes the frame relative to the DEFAULT
// state, so the scrollback's last row must not leave its attributes active.
return `${scrollback.replace(/\n$/, '')}\x1b[0m\n${frame}`;
}
/** Pane geometry and caret position, as `display-message` reports them. */