Skip to content

Fix terminal scroll jumps after redraws and task switches - #253

Merged
pallaoro merged 1 commit into
mainfrom
i-ve-noticed-that-codex-terminals-sometimes
Sep 13, 2026
Merged

pallaoro merged 1 commit into
mainfrom
i-ve-noticed-that-codex-terminals-sometimes

Conversation

@pallaoro

Copy link
Copy Markdown
Member

Terminal redraws that clear scrollback and stream replacement output in separate chunks could move the viewport above the latest output, especially after switching tasks. Defer bottom restoration until xterm's viewport updates and native scroll events settle, and resync the scrollbar when revealing a hidden terminal.

Preserve deliberate scrolling while output arrives or the terminal resizes. User input cancels pending corrections, and switching tasks discards late snapshots and callbacks for disposed terminals.

Validation: reproduced the original jump in Electron; the fix passed 100 redraw repetitions. Added an invisible Electron regression runner covering split redraws, manual scrolling, resizing, task switches, hidden output, and teardown (bun apps/desktop/scripts/test-terminal-scroll.ts). Desktop and fixture typechecks, targeted Biome checks, and git diff --check passed.

@pallaoro
pallaoro merged commit 37a1cc2 into main Sep 13, 2026
1 check passed
@pallaoro pallaoro mentioned this pull request Sep 13, 2026
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