Skip to content

fix(tui): restore the input position after an inline dialog closes - #375

Merged
ZouR-Ma merged 2 commits into
mainfrom
fix/tui-restore-bottom-after-interaction
Nov 29, 2026
Merged

ZouR-Ma merged 2 commits into
mainfrom
fix/tui-restore-bottom-after-interaction

Conversation

@ZouR-Ma

@ZouR-Ma ZouR-Ma commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

In regular terminal mode, open /model, then press Esc without changing the model. The taller selector can scroll the terminal; after it closes, clearing its rows does not bring the preceding document rows back into view, leaving the input above a blank area. Asynchronous completion-menu updates can leave the same gap. Separately, native clarify_user kept its working indicator running while blocked on the user.

Changes

  • Re-anchor the regular viewport on keyboard input, focus changes, or their asynchronous render continuations if the document ends above the active screen bottom after scrolling. Ordinary background updates do not use this recovery path.
  • Use the existing waitingForApproval presentation for native clarification dialogs. The focus and synchronized-output fixes remain in fix(coding-agent,tui): keep the clarification cursor inside the dialog #322; this PR does not duplicate their changes.
  • Add virtual-terminal viewport regressions and a native clarification test.

Behavior and compatibility

No settings, persisted data, or accepted input change. Existing requestRender calls keep their behavior; the new interaction option is optional. When re-anchoring is required, regular mode rebuilds terminal scrollback from the document; it cannot restore the terminal emulator's previous scroll position. Fullscreen rendering is unaffected by this recovery path.

Validation

  • macOS arm64, Node 24.3.0, pnpm 9.15.9.
  • pnpm run check (passed).
  • TMPDIR=/tmp ./test.sh (passed; the shorter temp root avoids macOS's Unix socket path limit).
  • cd packages/tui && node --test --test-name-pattern='shrink after interaction' test/tui-render.test.ts (4 passed).
  • cd packages/coding-agent && pnpm exec vitest --run test/step-capabilities-extension.test.ts (8 passed with host overrides unset).

Limitations

The scan for a viewport gap relies on terminal buffer coordinates rather than the terminal emulator's scroll thumb. Native IME candidate placement is tracked by #322; it is not assessed by this change.

@ZouR-Ma
ZouR-Ma merged commit dd4d756 into main Nov 29, 2026
2 checks passed
@ZouR-Ma
ZouR-Ma deleted the fix/tui-restore-bottom-after-interaction branch November 29, 2026 06:46
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