Textarea cursor doesn't auto-scroll when typing long prompts #7446

Open
opened 2026-02-16 18:07:11 -05:00 by yindo · 1 comment
Owner

Originally created by @jubayeramb on GitHub (Jan 24, 2026).

Originally assigned to: @rekram1-node on GitHub.

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:

  1. The cursor moves but the viewport doesn't follow, leaving the text invisible
  2. Black/empty spaces appear where text should be visible
  3. The cursor can go below the textarea boundary
  4. 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

  1. Run bun dev
  2. Start typing a long multi-line prompt (more than 6 lines)
  3. Observe that the cursor disappears from view as you type beyond the visible area
  4. Manually scroll down to see the typed text

Screenshot and/or share link

https://github.com/user-attachments/assets/e66fe6a3-f29d-41ef-a036-37ad3c7bbdca

Operating System

macOS Darwin 25.2.0 (arm64)

Terminal

VS Code integrated terminal (1.108.2), Shell: zsh

Originally created by @jubayeramb on GitHub (Jan 24, 2026). Originally assigned to: @rekram1-node on GitHub. ### 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: 1. The cursor moves but the viewport doesn't follow, leaving the text invisible 2. Black/empty spaces appear where text should be visible 3. The cursor can go below the textarea boundary 4. 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 1. Run `bun dev` 2. Start typing a long multi-line prompt (more than 6 lines) 3. Observe that the cursor disappears from view as you type beyond the visible area 4. Manually scroll down to see the typed text ### Screenshot and/or share link https://github.com/user-attachments/assets/e66fe6a3-f29d-41ef-a036-37ad3c7bbdca ### Operating System macOS Darwin 25.2.0 (arm64) ### Terminal VS Code integrated terminal (1.108.2), Shell: zsh
yindo added the opentuibug labels 2026-02-16 18:07:11 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 24, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #8874: Long text gets cut off and bottom content disappears in the editor

Both issues involve textarea/editor content not being properly displayed when dealing with longer text. Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 24, 2026): This issue might be a duplicate of existing issues. Please check: - #8874: Long text gets cut off and bottom content disappears in the editor Both issues involve textarea/editor content not being properly displayed when dealing with longer text. Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7446