struct
Tput::InputEvent
- Tput::InputEvent
- Struct
- Value
- Object
Overview
One unit of terminal input, as yielded by Tput::Input#listen. Exactly one
kind is meaningful per event — mouse report, paste, in-band resize, or key
transition — told apart with the predicates below; remaining fields are nil.
#char/#key/#sequence— the key transition (and the raw bytes).#mouse— a parsed mouse/focus report (#mouse?).#paste— bracketed-paste body (#paste?).#resize— in-band resize report (#resize?).#key_event— the rich keyboard event, when an enhanced protocol is active (carries modifiers, press/repeat/release, …).
Defined in:
tput/input.crConstructors
Instance Method Summary
- #char : Char
-
#clipboard : String | Nil
Decoded text of an OSC 52 clipboard read reply (
request_clipboard). -
#clipboard? : Bool
Whether this event is an OSC 52 clipboard read reply.
- #color_scheme : ColorScheme | Nil
-
#color_scheme? : Bool
Whether this event is a color-scheme (light/dark) change report.
- #key : Key | Nil
- #key_event : KeyEvent | Nil
-
#key_transition? : Bool
Whether this event is a key transition (not mouse/paste/resize/scheme/clipboard).
- #mouse : Mouse::Event | Nil
-
#mouse? : Bool
Whether this event is a mouse/focus report.
- #paste : String | Nil
-
#paste? : Bool
Whether this event is a bracketed paste.
-
#release? : Bool
Whether this is a key release (only when enhanced event reporting is on).
-
#repeat? : Bool
Whether this is an auto-repeat key event.
- #resize : Resize | Nil
-
#resize? : Bool
Whether this event is an in-band resize report.
-
#sequence : Array(Char)
Raw input bytes for this event.
-
#sequence? : Array(Char) | Nil
The raw input sequence as stored —
nilfor a single-character event (plain typing).
Constructor Detail
Instance Method Detail
Decoded text of an OSC 52 clipboard read reply (request_clipboard).
Distinct from #paste: this is the answer to a programmatic clipboard
query, not user-pasted input.
Whether this event is a key transition (not mouse/paste/resize/scheme/clipboard).
Raw input bytes for this event. A single-character event carries no array
— #listen passes nil and the byte is reconstructed here on demand, so
plain typing allocates nothing unless a consumer reads the sequence.
The raw input sequence as stored — nil for a single-character event
(plain typing). Unlike #sequence, this never materializes a
one-element [@char] array, so a consumer that can carry the nilable
form through avoids the per-keypress allocation.