mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-26 21:36:31 +02:00
VS Code's integrated terminal (xterm.js) interprets the erase-in-display-3 escape (\x1b[3J) as "drop scrollback rows AND snap the viewport to the top of the remaining buffer." Once the user has reopened a terminal with VS Code's persistent-sessions feature on, there is real replayed scrollback above the live cursor, so the snap is visible: the host scrollbar yanks to the top on every full repaint — first paint, Ctrl+L (Renderer.Clear), and any writeFull(true) shrink. Every other terminal we tested (iTerm, Ghostty, Kitty, Alacritty, Apple Terminal) treats \x1b[3J as "drop scrollback rows without moving the viewport," which is what we want. Detect VS Code (and Cursor, which shares xterm.js) via $TERM_PROGRAM == "vscode" in NewRenderer and stash the result on the Renderer as keepScrollback. Gate all three emission sites (resize handler, Clear(), writeFull(true)) through a single helper clearScrollbackSeq() that returns "" when keepScrollback is true and SeqClearScrollback otherwise. Trade-off on VS Code: stale zot frames remain visible if you scroll up in the terminal's scrollback. Strictly less disruptive than the scrollbar yanking on every Ctrl+L, and limited to the one terminal that actually has the bug. |
||
|---|---|---|
| .. | ||
| agent | ||
| assets | ||
| auth | ||
| core | ||
| extproto | ||
| provider | ||
| skills | ||
| tui | ||