Skip to content

Add C-c session keybindings to input buffer#252

Open
SayreBlades wants to merge 1 commit into
dnouri:masterfrom
SayreBlades:input-c-c-key-parity
Open

Add C-c session keybindings to input buffer#252
SayreBlades wants to merge 1 commit into
dnouri:masterfrom
SayreBlades:input-c-c-key-parity

Conversation

@SayreBlades

Copy link
Copy Markdown
Collaborator

The chat buffer exposes session management through C-c chords, but the input buffer only had a subset, forcing a window switch for common operations. This mirrors the remaining chords in pi-coding-agent-input-mode-map:

Key Command
C-c C-n pi-coding-agent-new-session
C-c C-e pi-coding-agent-export-html
C-c C-m pi-coding-agent-select-model
C-c C-t pi-coding-agent-cycle-thinking
C-c C-y pi-coding-agent-copy-last-message

(C-c C-r resume was already bound in the input map.)

All five commands resolve the session process and chat buffer through pi-coding-agent--get-process, pi-coding-agent--get-chat-buffer, and pi-coding-agent--menu-state, which already work from either buffer — so no command changes are needed.

C-c C-c intentionally stays pi-coding-agent-send in the input buffer; compact remains available there via C-c C-p c.

Tests: extended pi-coding-agent-test-input-mode-keybindings with the new chords, and added pi-coding-agent-test-input-chat-c-c-key-parity, which walks the chat map's C-c submap and asserts every chord is bound identically in the input map — future additions to either map can't silently drift. Also documented the new input rows in the README key table.

Mirror the chat buffer's C-c session-management chords in
pi-coding-agent-input-mode-map so they work without switching
windows: C-c C-n (new session), C-c C-e (export HTML), C-c C-m
(select model), C-c C-t (cycle thinking), and C-c C-y (copy last
message).  C-c C-r (resume) was already bound.

All of these commands resolve the session process and chat buffer
through accessors that work from either buffer, so no command
changes are needed.  C-c C-c intentionally stays pi-coding-agent-send
in the input buffer (compact remains available via C-c C-p c).

Add an ERT parity test that walks the chat map's C-c submap and
asserts every chord is bound identically in the input map, so future
additions cannot drift.
@SayreBlades
SayreBlades requested a review from dnouri July 22, 2026 03:38
@dnouri

dnouri commented Jul 22, 2026

Copy link
Copy Markdown
Owner

What's a window switch? :-)

What do you think about doing the opposite of removing all C-c chords for consistency, and only defining C-c C-p ones? As you noted, there's already a confusion with compaction.

I'm open to merging this but just wondering what the real benefit here is over using the C-c C-p chords?

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.

2 participants