Skip to main content

key_to_pane_command

Function key_to_pane_command 

Source
pub fn key_to_pane_command(
    key: &KeyEvent,
    resize_units: u16,
) -> Option<PaneCommand>
Expand description

Translate a raw terminal key event into a canonical PaneCommand.

Returns None for key release events and for any key not in the default pane keymap (so the host passes those through to the application). The keymap is intentionally modifier-qualified to avoid stealing plain keys:

KeyCommand
Tab / Shift+TabFocusNext / FocusPrevious
Ctrl+ArrowFocusDirectional
Ctrl+Shift+ArrowFocusEdge
Alt+ArrowMovePane
Alt++ / Alt+-ResizeStep grow / shrink
Alt+s / Alt+vSplit horizontal / vertical
Alt+wClose
Alt+[ / Alt+]SwapPane previous / next
Alt+z / Alt+rMaximize / Restore

resize_units is the snap-step count for ResizeStep (computed by the caller via PaneCommandAcceleration); it is ignored for other commands.