feat: add #{pane_last_special_key} — read-only non-text-key route signal#315
feat: add #{pane_last_special_key} — read-only non-text-key route signal#315quazardous wants to merge 1 commit into
Conversation
The sibling of #{pane_last_text_input} (psmux#311) for the complement: the last
NON-text key that reached a pane via the interactive input route, by canonical
bind-key name, plus its age.
- #{pane_last_special_key} — name (Escape, Enter, Up, F9, C-c, M-a, …)
- #{pane_last_special_key_ms} — ms since it arrived
Same contract as psmux#311: one Option<(Instant, String)> on the Pane (no file, no
lifecycle); set only in forward_key_to_active so the injected route never
updates it; per-pane, stamping exactly the panes that receive the key. Reuses
is_text_input_key for the text/non-text split and format_key_binding (the
list-keys renderer) for the name. Helper for_each_receiving_pane factors the
sync-input-aware pane selection.
Add two read-only per-pane format variables for the last non-text key
received on the interactive input route:
- #{pane_last_special_key} -- canonical bind-key name (Escape, Enter,
Up, F9, C-c, M-a, ...)
- #{pane_last_special_key_ms} -- milliseconds since it arrived
Complement of #{pane_last_text_input} (#311): together they partition
all interactive keys into text vs non-text. Same route contract: set
only in forward_key_to_active (the injected route never updates it).
Also refactors the sync-input-aware pane selection into a shared
for_each_receiving_pane helper, deduplicating the text-input stamping.
Includes unit tests (key classification + naming) and E2E test.
Co-authored-by: David Berlioz <berliozdavid@gmail.com>
|
Hey @quazardous, great follow-up to #311. Applied in aca1120 with your Co-authored-by credit. What I verified:
Regarding your open questions:
Note on tmux parity: tmux does not have Thanks for the clean implementation, David. |
1 similar comment
|
Hey @quazardous, great follow-up to #311. Applied in aca1120 with your Co-authored-by credit. What I verified:
Regarding your open questions:
Note on tmux parity: tmux does not have Thanks for the clean implementation, David. |
|
Applied in commit aca1120 with Co-authored-by credit. Thanks @quazardous! |
What
Two read-only per-pane format variables describing the last non-text key that reached a pane via the interactive input route:
#{pane_last_special_key}— its canonical bind-key name (Escape,Enter,Tab,Up,F9,C-c,M-a, …), empty until the first one.#{pane_last_special_key_ms}— ms since it arrived.The sibling of
#{pane_last_text_input}(#311) for the complement: together they partition all interactive keys into text vs non-text.Why / design (same constraints as #311)
Option<(Instant, String)>on thePane, freed with it.forward_key_to_active; the injected route (send-keys/send-paste/send-text→send_text_to_active) never updates it.for_each_receiving_panehelper).is_text_input_key(feat: add#{pane_last_input}— read-only live human-input signal #311) for the text/non-text split andformat_key_binding(thelist-keysrenderer) for the name, so the value is the canonical key syntax users already know.Open question — is this the right orientation?
Before polishing I'd like your read on the shape:
#{pane_last_key}over all keys (which would overlap#{pane_last_text_input}), or something narrower?pane_last_special_key/_msOK?format_key_binding(bind-key syntax, as here), or another form?Happy to adjust to whatever fits psmux best.
Diff
One field on
Pane+ its inits; afor_each_receiving_panehelper + the text/non-text stamp inforward_key_to_active; two format arms; unit tests; a doc note.Tests
cargo test --bin psmux pane_last—tests-rs/test_pane_last_special_key.rs, passes alongside #311's. The positive live path needs an attached client, so it's covered by the unit test + the single set site (same as #311).