You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] TUI scroll position resets to session start after approving commands that exceed terminal height #6895
After upgrading to v1.0.223, when approving a bash command whose output exceeds the terminal's vertical space, the TUI resets scroll position to the first message in the session instead of staying at the current position.
Steps to Reproduce
Start a session with several messages (enough to require scrolling)
Have Claude execute a command that produces output taller than the terminal window
Approve the command (press y or Enter)
After command completes, observe scroll position
Expected Behavior
TUI should remain scrolled to the current message/command output area.
Actual Behavior
TUI jumps to the first message in the session, forcing user to scroll through entire conversation history to return to current context.
Environment
opencode version: v1.0.223
OS: Linux
Terminal: WezTerm
Notes
This is a regression - did not occur in previous versions. Particularly disruptive in long sessions.
After further testing, this appears to be two distinct issues:
Bug 1: Dialog overflow (terminal-agnostic)
The approval dialog extends past the TUI viewport when the command text exceeds terminal height. User cannot scroll within the dialog to see the full command, forcing a blind approve.
Reproduces in: WezTerm ✅, Alacritty ✅
Bug 2: Scroll-to-top after approve (WezTerm-specific)
After approving an oversized command, the TUI scroll position resets to the first message in the session.
Reproduces in: WezTerm ✅, Alacritty ❌
Test Matrix
Session Length
Terminal
Dialog Overflow
Scroll-to-top
Short
WezTerm
✅
❌
Long
WezTerm
✅
✅
Short
Alacritty
✅
❌
Long
Alacritty
✅
❌
Root Cause Hypothesis
Dialog overflow: OpenCode doesn't constrain dialog height to viewport or implement internal scrolling for the approval modal.
Scroll-to-top: WezTerm handles alternate screen buffer or scroll region escape sequences differently than Alacritty. The TERM=xterm-256color (WezTerm) vs TERM=alacritty difference may trigger different terminfo code paths.
Tested on GNOME Terminal which also uses TERM=xterm-256color like WezTerm.
Results
Dialog overflow: ✅ Yes (same as all terminals)
Scroll-to-top: ❌ No
Updated Test Matrix
Terminal
TERM
Dialog Overflow
Scroll-to-top
WezTerm
xterm-256color
✅
✅
GNOME Terminal
xterm-256color
✅
❌
Alacritty
alacritty
✅
❌
Conclusion
The scroll-to-top bug is WezTerm-specific, not related to the TERM value. Both GNOME Terminal and WezTerm use xterm-256color but only WezTerm exhibits the scroll reset behavior.
This points to something specific in WezTerm's:
Alternate screen buffer handling
Scroll region escape sequence interpretation
Or how it handles the TUI framework's viewport management
Correction: Scroll-to-top reproduces in Alacritty with longer sessions
With a sufficiently long session, the scroll-to-top bug does reproduce in Alacritty.
Updated Understanding
The scroll-to-top is not terminal-specific - it's an OpenCode bug that triggers based on session length. WezTerm just has a lower threshold to trigger it.
Terminal
Dialog Overflow
Scroll-to-top (short session)
Scroll-to-top (long session)
WezTerm
✅
✅ (triggers earlier)
✅
GNOME Terminal
✅
❌
Not yet tested
Alacritty
✅
❌
✅
Root Cause Hypothesis (revised)
Both bugs are likely OpenCode core issues:
Dialog overflow: No height constraint or internal scroll for approval modal
Scroll-to-top: Viewport/scroll position not preserved after dismissing oversized modal - severity varies by terminal but fundamentally an OpenCode issue
WezTerm may just be more sensitive to whatever scroll position handling OpenCode is doing.
Activity
marcohmann commentedon Jan 5, 2026
Additional Reproduction Details
Confirmed Variables
Terminal-specific: Bug reproduces in WezTerm but not in Alacritty.
xterm-256coloralacrittyBoth terminals report identical dimensions (
tput lines= 24,tput cols= 80).Refined Reproduction Steps
Minimal Reproduction Command
Hypothesis
The
TERM=xterm-256colorvsTERM=alacrittydifference may cause different terminfo capability handling for:marcohmann commentedon Jan 5, 2026
Updated Findings: Two Separate Bugs
After further testing, this appears to be two distinct issues:
Bug 1: Dialog overflow (terminal-agnostic)
The approval dialog extends past the TUI viewport when the command text exceeds terminal height. User cannot scroll within the dialog to see the full command, forcing a blind approve.
Reproduces in: WezTerm ✅, Alacritty ✅
Bug 2: Scroll-to-top after approve (WezTerm-specific)
After approving an oversized command, the TUI scroll position resets to the first message in the session.
Reproduces in: WezTerm ✅, Alacritty ❌
Test Matrix
Root Cause Hypothesis
Dialog overflow: OpenCode doesn't constrain dialog height to viewport or implement internal scrolling for the approval modal.
Scroll-to-top: WezTerm handles alternate screen buffer or scroll region escape sequences differently than Alacritty. The
TERM=xterm-256color(WezTerm) vsTERM=alacrittydifference may trigger different terminfo code paths.marcohmann commentedon Jan 5, 2026
Further Testing: GNOME Terminal (Ubuntu default)
Tested on GNOME Terminal which also uses
TERM=xterm-256colorlike WezTerm.Results
Updated Test Matrix
xterm-256colorxterm-256coloralacrittyConclusion
The scroll-to-top bug is WezTerm-specific, not related to the
TERMvalue. Both GNOME Terminal and WezTerm usexterm-256colorbut only WezTerm exhibits the scroll reset behavior.This points to something specific in WezTerm's:
marcohmann commentedon Jan 5, 2026
Correction: Scroll-to-top reproduces in Alacritty with longer sessions
With a sufficiently long session, the scroll-to-top bug does reproduce in Alacritty.
Updated Understanding
The scroll-to-top is not terminal-specific - it's an OpenCode bug that triggers based on session length. WezTerm just has a lower threshold to trigger it.
Root Cause Hypothesis (revised)
Both bugs are likely OpenCode core issues:
WezTerm may just be more sensitive to whatever scroll position handling OpenCode is doing.
github-actions commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
excess122 commentedon Apr 20, 2026
I can reproduce this on Windows as well.
Environment:
Reproduction steps:
Observed behavior:
This appears to be the same viewport/scroll issue described in the original report, confirmed on Windows.