Skip to content

feat(tui): Tab accepts the composer's suggested query placeholder#690

Merged
ericleepi314 merged 1 commit into
mainfrom
feat/tui-tab-accept-suggestion
Jul 10, 2026
Merged

feat(tui): Tab accepts the composer's suggested query placeholder#690
ericleepi314 merged 1 commit into
mainfrom
feat/tui-tab-accept-suggestion

Conversation

@ericleepi314

Copy link
Copy Markdown
Collaborator

Summary

The composer's dim placeholder on a fresh idle session (Try "explain this codebase", Try "/help" for commands, …) is a system suggestion of a query — but there was no way to take it. Plain Tab now accepts it: the suggested query is inserted into the input with the cursor at the end.

  • Try "explain this codebase" → inserts explain this codebase
  • Try "write a test for…" → inserts write a test for (ellipsis dropped, trailing space kept so the sentence is continuable)
  • Try "/help" for commands → inserts /help and pops the slash completion menu exactly as if typed
  • Ask me anything… carries no query → Tab stays inert

Mirrors original CC's Tab fallback (typescript/src/hooks/useTypeahead.tsx handleKeyDown: tab / no shift / no suggestions / empty input → accept the prompt suggestion); there the suggestion state holds the bare query, ours is embedded in the Try "…" placeholder string, hence the extraction helper.

Gating

shouldAcceptPlaceholderSuggestion mirrors the placeholder-visibility condition exactly (conversation empty + idle + empty input, threaded as InputHandlerContext.conversationEmpty from the same flag appLayout renders from), plus no-completions and no-shift — so Tab can never insert what isn't displayed and never shadows completion-accept or the Shift+Tab permission-mode cycle.

Verification

  • 16 unit tests (extraction incl. round-trip invariant over the shipped list; all six predicate gates); tsc --noEmit and eslint clean
  • Full ui-tui vitest: zero new failures (8 pre-existing environmental failures proven identical on clean main via stash/run/pop; 1 known full-suite-load flake)
  • Live pyte e2e in a real PTY against the dev backend: all three placeholder families pass (plain query, ellipsis stub, /help + menu), incl. second-Tab-inert; PTY-resize repaint used to defeat cell-diff renderer artifacts in pyte
  • Critic subagent: APPROVE · Codex adversarial review: approve, no material findings

🤖 Generated with Claude Code

Plain Tab on a fresh, idle, empty composer inserts the query suggested by
the dim `Try "…"` placeholder (cursor at end); an open-ended stub like
`write a test for…` drops the ellipsis and keeps a trailing space, and a
suggested /command pops its completion menu exactly as if typed. Mirrors
original CC's Tab fallback (useTypeahead.tsx: tab / no shift / no
suggestions / empty input → accept the prompt suggestion).

Gated on the exact placeholder-visibility condition (conversation empty,
not busy, empty input, no completions) so Tab can never insert what isn't
displayed, and never shadows completion-accept or Shift+Tab mode cycle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ericleepi314 ericleepi314 merged commit 20e7296 into main Jul 10, 2026
2 checks passed
@ericleepi314 ericleepi314 deleted the feat/tui-tab-accept-suggestion branch July 10, 2026 06:41
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