Skip to content

fix(tui): select first row when opening terminals tab - #48490

Open
kitlangton wants to merge 1 commit into
v2from
terminal-tab-focus
Open

fix(tui): select first row when opening terminals tab#48490
kitlangton wants to merge 1 commit into
v2from
terminal-tab-focus

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Why

Opening the Terminals tab with no visible terminal leaves every row unselected. When the list is empty, even the only action, + New terminal, requires an arrow key before Enter does anything.

What Changes

Fall back to the first row when there is no matching visible terminal.

State on opening Selection
No terminals + New terminal
Existing terminals, none visible First terminal
A listed terminal is visible That terminal

Demo

terminal-focus-before-after.mp4

Matched OpenCode Drive runs of the production TUI: before cd504dc66a, after bc784ff718. Both use the same isolated project, simulated model response, 90×24 terminal viewport, and interaction: open the picker, switch to Terminals, then press Enter. The clips play sequentially at native resolution for legibility, with equal-duration holds and no acceleration. Before, Enter leaves the picker open; after, it opens the terminal pane.

Scope

One-line change to the Terminals tab's initial-selection fallback.

Verification

# packages/tui
bun typecheck

# Same script, two development checkouts
opencode-drive check terminal-focus-demo.ts
opencode-drive start --name terminal-focus-before --record --script terminal-focus-demo.ts --dev ../opencode-terminal-tab-before
opencode-drive start --name terminal-focus-after --record --script terminal-focus-demo.ts --dev ../opencode-terminal-tab-focus

git diff --check

All passed. Both recorded runs completed and their frames were inspected. The pre-push hook also passed all 33 typecheck tasks using Bun 1.4.2 (27 cached).

@kitlangton
kitlangton enabled auto-merge (squash) September 11, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant