Skip to content

feat(tui): start a chat draft from any block but the terminal panel - #693

Merged
mohitranka merged 1 commit into
mainfrom
forge/I-want-to-increase-the-surface-area-when
Sep 15, 2026
Merged

mohitranka merged 1 commit into
mainfrom
forge/I-want-to-increase-the-surface-area-when

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Widens the surface that reaches the chat input: any printable key the focused block has no binding for now starts (or continues) a draft in the composer, from every block except the terminal panel.

Why

type_to_compose treated Footer, TaskStrip and Sidebar as control surfaces that kept every keystroke. A printable key with no local binding in those blocks was dropped, so focusing the composer stayed the only way in — clicking the transcript column (the SIDEBAR block) left the keystroke with nowhere to go.

What changed

  • Only Panel keeps an unconsumed printable key (app/input.rs::keeps_unconsumed_typing); its PTY owns every byte the panel does not claim.
  • Each block's own bindings are matched first, so no displayed shortcut loses to a draft: n/s/d in the session list, x/a/d/i in the transcript, the footer chips.
  • Focus moves with the character, so a draft is never inserted behind a pane still painted as the keyboard owner (invariant 2).
  • Docs: the README keyboard table and FORGE-DESIGN §8.3 carry the rule and its exception.

This reverses two deliberate guards — please confirm the call

Both inputs are reachable again. The text now lands, visibly, in the composer instead of being swallowed — but the footer path in particular is the same one-keypress-from-Tab hazard.

Left alone

  • The navigator tab row is a sub-focus of the navigator column rather than a block, and still keeps bare keys (handle_navigator_tab_row_key returns Ok(true) for anything unmodified, pinned by session_verbs_do_not_fire_from_the_tab_row). Happy to make it follow the same rule if the row should behave like the panes.
  • Paste is unchanged: bracketed paste / Ctrl+Shift+V still only reaches the composer from the composer block. Widening it means mirroring every field owner (editor, search filter, navigator buffers), or paste would land in the wrong pane.

Verification

  • cargo test --package forge-tui --locked app:: → 514 passed, 5 failed. All 5 fail identically on a clean main in this environment (sandbox-denied bash tool calls plus one file-watcher test), so they are environment failures, not regressions.
  • cargo fmt --all -- --check clean.
  • cargo clippy --package forge-tui --all-targets --locked -- -D warnings clean.
  • Rewrote the two tests that pinned the old drop behavior; added terminal_panel_keeps_unbound_typing and control_surface_verbs_still_beat_type_to_chat.

`type_to_compose` refused Footer, TaskStrip and Sidebar as control
surfaces, so a printable key with no local binding there was dropped: a
click on the transcript column (SIDEBAR) left the keystroke with nowhere
to go, and the composer stayed the only way in.

Only `Panel` keeps an unconsumed printable key now — its PTY owns every
byte the panel does not claim. Everywhere else the block's own bindings
are matched first, so a displayed shortcut never loses to a draft
(`n`/`s`/`d` in the session list, `x`/`a`/`d`/`i` in the transcript, the
footer chips), and focus moves with the character, so a draft is never
inserted behind a pane still painted as the keyboard owner.

This reverses two deliberate guards: 56deb92 kept the footer's keys so a
shell line typed after one Tab could not become a draft, and 212deec
(#665) kept `:q`/`/quit` out of chat from the session list and the
transcript. Both inputs are reachable again; they surface the text in the
composer instead of swallowing it.

Docs: the README keyboard table and FORGE-DESIGN 8.3 carry the rule and
its exception. The tests pinned to the old drop behavior are rewritten,
with new coverage for the terminal carve-out and for bound keys beating
type-to-chat. Paste is unchanged: bracketed paste still only reaches the
composer from the composer block.
@mohitranka
mohitranka merged commit fe54d35 into main Sep 15, 2026
3 checks passed
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