Expand description
Key forwarding — abstracts how the UI streams keystrokes into a
tmux pane so tests can stub it out. Production hits
tmux send-keys; tests pass a MockKeySender recording every
call. Mirrors the trait + prod + mock shape pane.rs uses for
capture so the two surfaces evolve together.
Used by Stage::StreamKeys (the ticket-#108 modal): once stream
mode is active, every operator keystroke that isn’t Esc gets
translated to a tmux key-name and shipped over.
Modules§
- test_
support - Test fixtures. Made
pub(rather than#[cfg(test)]) so the integration tests intests/can reach them — same pattern ascompose::test_supportandmailbox::test_support.
Structs§
- Async
KeySender - Non-blocking
KeySenderdecorator — moves the blockingtmuxround-trip off the caller’s thread.send/scrollenqueue onto an unbounded channel and return immediately (sub-microsecond); a single background thread drains the channel in FIFO order and replays each job against the wrapped sender. - Encoded
Key - One encoded keystroke ready for
tmux send-keys. Carries the argument list so the prod impl can shell out without re-doing the translation, and so tests can inspect exactly what the encoder produced. - Tmux
KeySender - Production implementation — shells out to
tmux send-keys, one subprocess per keystroke. The round-trip blocks the caller ~3ms (pure tmux client/server cost; the key delivery itself is free), so the TUI wraps this inAsyncKeySenderto keep that block off its render/event loop (#386).
Enums§
- Scroll
Direction - Direction of one mouse-wheel tick. Maps to tmux copy-mode commands
scroll-up/scroll-down.
Traits§
- KeySender
- Lookup contract: forward one tmux key-name to the named session.
keyis already encoded — seeencode_keyfor the crossterm → tmux translation. The production implementation (TmuxKeySender) blocks on atmux send-keysround-trip; callers on a latency- sensitive thread should wrap it inAsyncKeySenderso the round- trip happens off the caller’s thread (#386).
Functions§
- encode_
key - Translate a crossterm
KeyEventto the formtmux send-keysexpects. ReturnsNonefor keys we deliberately drop (release events on kitty-protocol terminals, modifier-only presses).