-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Description
When typing a long prompt in the TUI input textarea that exceeds the visible area (maxHeight of 6 lines), the cursor doesn't automatically scroll to stay in view. This causes several issues:
- The cursor moves but the viewport doesn't follow, leaving the text invisible
- Black/empty spaces appear where text should be visible
- The cursor can go below the textarea boundary
- The bottom status bar (model name, variants) occasionally renders outside its boundary
Expected Behavior
The textarea should auto-scroll to keep the cursor visible as the user types, similar to standard text editor behavior.
Root Cause
The onContentChange handler in the prompt component updates state but doesn't trigger a layout recalculation and re-render. This causes the viewport to become out of sync with the cursor position.
Proposed Fix
Add markDirty() and requestRender() calls to the onContentChange handler, matching the pattern already used in onPaste and TuiEvent.PromptAppend handlers.
File: packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
Plugins
opencode-antigravity-auth@latest
OpenCode version
1.1.34
Steps to reproduce
- Run
bun dev - Start typing a long multi-line prompt (more than 6 lines)
- Observe that the cursor disappears from view as you type beyond the visible area
- Manually scroll down to see the typed text
Screenshot and/or share link
opencode-input-scrolling-issue.mp4
Operating System
macOS Darwin 25.2.0 (arm64)
Terminal
VS Code integrated terminal (1.108.2), Shell: zsh