fix(tui): clear stale scrollback on session switch (#2155)

fullRender wrote \x1b[3J\x1b[2J\x1b[H (clear scrollback, then clear
screen). But \x1b[2J pushes on-screen content into scrollback, undoing
the preceding \x1b[3J. Reorder to \x1b[2J\x1b[H\x1b[3J so the screen is
cleared first and scrollback is wiped last.
This commit is contained in:
Sviatoslav Abakumov
2026-03-14 19:00:34 +04:00
committed by GitHub
parent 962c12444d
commit fa26f15e68

View File

@@ -900,7 +900,7 @@ export class TUI extends Container {
const fullRender = (clear: boolean): void => {
this.fullRedrawCount += 1;
let buffer = "\x1b[?2026h"; // Begin synchronized output
if (clear) buffer += "\x1b[3J\x1b[2J\x1b[H"; // Clear scrollback, screen, and home
if (clear) buffer += "\x1b[2J\x1b[H\x1b[3J"; // Clear screen, home, then clear scrollback
for (let i = 0; i < newLines.length; i++) {
if (i > 0) buffer += "\r\n";
buffer += newLines[i];