feat(llm,keymap): Ctrl+Up/Down jump focus between chat panel and shell#77
Merged
Conversation
User-requested polish: while the inline chat panel is open, the user
wants to type into the SHELL PROMPT above the panel WITHOUT closing
the chat. Today every keystroke is swallowed into the chat input
buffer; user has to press Alt+C to close, type the shell command,
reopen with Alt+C — clunky.
New flow:
Ctrl+Up — focus jumps to shell prompt (panel stays painted,
dims its block-cursor + input row to signal "parked").
Ctrl+Down — focus jumps back into the panel.
Alt+C — closes the panel (as before); on next open, focus
starts back in the panel (parked-state doesn't leak
across sessions).
Implementation:
- New `Runtime.chat_focus_in_panel: bool = true` field.
- Two new keymap actions (`chat_focus_to_shell`, `chat_focus_to_chat`)
with dual-encoded bindings (legacy CSI `\x1b[1;5A/B` + kitty
kbd via `key("Ctrl+Up")` / `key("Ctrl+Down")`).
- `onInput` only swallows when both `chat_inline_open` AND
`chat_focus_in_panel`. While parked, returns `.forward` so the
keystroke flows through to bash.
- `paintInlineChat` reads the focus flag: parked → real cursor
shown (`?25h`), input row chrome dimmed, block-cursor glyph
drawn as a dim outline (`▒` instead of reverse-video block).
- Action handler refuses to consume Ctrl+Up/Ctrl+Down when the
panel isn't open — so the keystroke flows through for tmux pane
navigation / shell history scroll / whatever.
2 new tests cover: focus-toggle round-trip + forwarding-while-parked +
no-op-without-panel; on-close-then-reopen focus resets to in-panel.
`zig build test` (511 pass) + `zig fmt --check` clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While the inline chat panel is open, allow the user to type into the SHELL PROMPT above the panel WITHOUT closing the chat.
Today every keystroke is swallowed into the chat input buffer; user has to press Alt+C to close, type the shell command, reopen with Alt+C — clunky.
New flow:
Ctrl+Up— focus jumps to shell prompt; panel stays painted but dims its block cursor + input row.Ctrl+Down— focus jumps back into the panel.Alt+C— closes the panel as before; on next open, focus starts back in the panel (parked-state doesn't leak across sessions).Implementation
Test plan
🤖 Generated with Claude Code