feat(picker): digit jump buffer + Enter in session chooser (#247)#248
Conversation
While the session picker (PREF s) is open: - Digits accumulate into a jump buffer shown at the bottom as "go to N". - Enter parses the buffer as a 1-based index and jumps; empty buffer falls back to the arrow cursor selection. - Backspace edits the buffer; Esc clears it and closes the picker. - Every row is numbered with a right-aligned dynamic-width column so the digit-to-session mapping is visible without trial and error. - Overlay height grows to accommodate the buffer indicator. Also absorbs all other character keys while the picker is open so they cannot leak through to the focused pane's PTY — fixes the pre-existing input-leakage side effect of the picker. Fixes #247.
|
Merged in bf0a14a. Thank you for the thoughtful contribution Tarik. What I really appreciated about this one:
Verified locally before merging:
Will go out in the next release. Thanks again for the clean PR and the test coverage that came with it. |
…stomize-mode PR #248 added digit+Enter quick-jump to the session picker. This commit extends the same UX to every other interactive picker in the client. choose-tree / choose-window - tree_num_buffer accumulates typed digits alongside picker state - Enter uses the buffer as a 1-based row index when non-empty, falls back to the arrow cursor otherwise - Backspace edits the buffer; Esc clears it and closes - catch-all KeyCode::Char(_) guard absorbs non-handled keys so they cannot leak through to the focused pane PTY - Every row is rendered with a right-aligned dynamic-width 1-based number so the mapping is visible - 'go to N' indicator shown at the bottom when buffer is non-empty - Overlay height grows by 2 rows when the indicator is active - PageUp / PageDown / Home / End added (were missing before) - Title updated: 'digits+enter=jump Enter=switch ...' choose-buffer - buffer_num_buffer with identical digit/Enter/Backspace/Esc/leak-guard - Enter jumps then pastes; d-delete clears the buffer (indexes shift) - Row numbers prepended to each 'bufferN: M bytes: ...' label - Overlay height grows by 2 rows when the indicator is active - PageUp / PageDown / Home / End added - Title updated: 'digits+enter=jump, Enter=paste ...' customize-mode - customize_num_buffer accumulates digits while not editing a value - Customize state lives server-side, so Enter computes a navigate delta (target_pos - current_pos) and dispatches customize-navigate <delta> to jump precisely - Buffer is cleared when editing starts or the overlay closes - 1-based row numbers shown as a prefix on each option row - 'go to N' indicator rendered at the bottom in a cyan bar - Header updated: 'digits+Enter:jump Enter:edit ...' tests/test_picker_digit_jump_all.ps1 35/35 passing - State declarations for all three buffers - Picker-open clears buffer - Digit / Enter / Backspace / Esc handlers - Leak-guard catch-all - Renderer: row numbering, 'go to N', title hints - Functional: choose-tree data (5 windows), choose-buffer data (3 buffers over TCP), customize data (56 options via show-options) - Layer-2: visible client survives multi-window CLI-driven session test_issue247_session_picker_digit.ps1 14/14 still passing (no regression)
|
Hey Tarik, your PR was the perfect foundation for something I wanted to extend further. The digit-jump UX you built for the session picker was so clean that I rolled it out to every other interactive picker in the client, all landed in commit 0f774f4 on master just now. What is covered now: choose-tree / choose-window (C-b w) choose-buffer (C-b =) customize-mode (C-b : then Tests Your original Really appreciated the clean architecture you set up in #248. Having a tight, isolated per-picker buffer with clear open/close/kill lifecycle made it straightforward to replicate everywhere. Good pattern. |
|
Loved this! |
Closes #247.
Summary
Make the session picker (
PREF s) accept a number-then-Enter jump, similar to how windows are selected by digit. Also closes the pre-existing side-effect where character keys typed into the picker leaked through to the focused pane's PTY.Behavior (while picker is open)
1..9,0— append to a jump buffer, shown at the bottom asgo to 12Enter— parse buffer as 1-based index and jump; empty buffer falls back to the arrow-cursor selection (existing behavior, unchanged)Backspace— delete the last digit from the bufferEsc— clear buffer and close pickerUp/Down/PageUp/PageDown/Home/End— arrow cursor navigation (unchanged)x— kill session at the arrow cursor (unchanged)Out-of-range or unparseable buffer on Enter is a silent no-op — buffer stays so the user can Backspace and fix. Killing a session clears the buffer since indexes shift.
UI changes
Test plan
cargo build --releasecleantests/test_issue247_session_picker_digit.ps1— 14/14 passing. Covers: state declaration, digit-buffer accumulator, no immediate-switch shortcut, Enter parses buffer as 1-based, Backspace pops, Esc clears, leak-guard catch-all, title hint, dynamic row numbering, buffer preview rendering, dynamic overlay height, and functional verification that the picker data source (port files +session-infoover TCP) reaches multiple sessions.C-b s, type a number, press Enter — jumps to that session. Backspace edits. Esc closes without side effects. Non-digit chars no longer leak to the PTY.