module
Tput::Keyboard
Overview
Enhanced keyboard protocol negotiation and enabling.
Tput#probe! detects which protocols the terminal supports; this module
picks the best one (honoring user exclusions) and turns it on/off. Mirrors
the image-backend resolve pattern: a ranked candidate list, minus
user-excluded protocols, picking the first the terminal actually supports,
falling back to the always-available Legacy baseline.
Parsing lives in Tput::Input#parse_key_event / Tput::KeyEvent: a
terminal that doesn't support (or that the user excluded) an enhanced
protocol simply never emits the richer sequences.
Direct including types
Defined in:
tput/keyboard.crInstance Method Summary
-
#best_keyboard_protocol : KeyboardProtocol
The keyboard protocol to use: an explicit
keyboard.protocolconfig override if set, otherwise the first ranked candidate that is neither user-excluded nor unsupported — falling back toLegacy, which always works. -
#disable_keyboard_protocol : Nil
Disables whatever enhanced protocol
#enable_keyboard_protocolturned on, restoring the terminal's default keyboard reporting. -
#disable_kitty_keyboard : Nil
Pops one entry off the terminal's kitty keyboard protocol stack (
CSI < u), undoing one#enable_kitty_keyboard. -
#disable_modify_other_keys : Nil
Disables xterm
modifyOtherKeys(CSI > 4 n). -
#enable_keyboard_protocol(events : Bool = false) : KeyboardProtocol
Enables the best available enhanced keyboard protocol (
#best_keyboard_protocol) and returns the protocol actually enabled (Legacymeans nothing extra was turned on). -
#enable_kitty_keyboard(flags : KittyKeyboard = KittyKeyboard::DisambiguateEscapeCodes) : Nil
Pushes a kitty keyboard flags set onto the terminal's protocol stack (
CSI > flags u); undo with#disable_kitty_keyboard. -
#enable_modify_other_keys(level : Int32 = 2) : Nil
Enables xterm
modifyOtherKeysat level (1 or 2), viaCSI > 4 ; Ps m. -
#excluded_keyboard_protocols : Array(KeyboardProtocol)
Protocols the user has excluded via the
keyboard.excludeconfig option (comma/space-separated names, e.g. -
#keyboard_candidates : Array(KeyboardProtocol)
Ranked candidate protocols, best → worst, always ending in
Legacy. -
#keyboard_protocol_supported?(protocol : KeyboardProtocol) : Bool
Whether protocol is usable on this terminal.
Instance Method Detail
The keyboard protocol to use: an explicit keyboard.protocol config
override if set, otherwise the first ranked candidate that is neither
user-excluded nor unsupported — falling back to Legacy, which always
works.
Disables whatever enhanced protocol #enable_keyboard_protocol turned on,
restoring the terminal's default keyboard reporting.
Pops one entry off the terminal's kitty keyboard protocol stack
(CSI < u), undoing one #enable_kitty_keyboard.
Enables the best available enhanced keyboard protocol
(#best_keyboard_protocol) and returns the protocol actually enabled
(Legacy means nothing extra was turned on).
Pass events true to also request modifier-aware and
press/repeat/release reporting — needed to observe lone modifier keys
and key releases (e.g. a "tap Alt" gesture). With events false only
escape-code disambiguation is requested, which never relocates ordinary
typing. Ignored by ModifyOtherKeys, which cannot report lone modifiers
or releases regardless.
Pushes a kitty keyboard flags set onto the terminal's protocol stack
(CSI > flags u); undo with #disable_kitty_keyboard.
Enables xterm modifyOtherKeys at level (1 or 2), via CSI > 4 ; Ps m.
Protocols the user has excluded via the keyboard.exclude config option
(comma/space-separated names, e.g. "kitty modify_other_keys"). Unknown
names are ignored. Mirrors crysterm's media.exclude.
Ranked candidate protocols, best → worst, always ending in Legacy.
Whether protocol is usable on this terminal. Legacy always is; the
enhanced ones require the corresponding Tput#probe! reply.