enum Tput::Modifiers

Overview

Keyboard modifiers, as a bitmask.

The bit order matches the modifier encoding shared by xterm (modifyOtherKeys) and the kitty keyboard protocol: the on-the-wire value is 1 + bitmask, with shift = 1, alt = 2, ctrl = 4, super = 8, hyper = 16, meta = 32, caps_lock = 64, num_lock = 128. So a raw modifier parameter Pm maps to Modifiers.new(Pm - 1) (see KeyEvent.from_csi).

Defined in:

tput/key_event.cr

Enum Members

Shift = 1
Alt = 2
Ctrl = 4
Super = 8
Hyper = 16
Meta = 32
CapsLock = 64
NumLock = 128
None = 0
All = 255

Instance Method Summary

Instance Method Detail

def alt? #

Returns true if this enum value contains Alt


[View source]
def caps_lock? #

Returns true if this enum value contains CapsLock


[View source]
def ctrl? #

Returns true if this enum value contains Ctrl


[View source]
def hyper? #

Returns true if this enum value contains Hyper


[View source]
def meta? #

Returns true if this enum value contains Meta


[View source]
def none? #

[View source]
def num_lock? #

Returns true if this enum value contains NumLock


[View source]
def pick_nav(base : Key, shift : Key, alt : Key, ctrl : Key) : Key #

Picks among the four legacy nav-key variants (base/shift/alt/ctrl) after dropping the ambient lock bits. The kitty protocol folds CapsLock/NumLock into this field; without stripping them, a commonly-on NumLock would make modified nav keys (Ctrl+Up, Shift+Home) fail the exact match below and degrade to base. Only a single shift/alt/ctrl selects a distinct member; any other combination (or super/meta) falls back to base.

Shared by the legacy CSI parser (Key.csi_modified) and the enhanced-keyboard projection (KeyEvent#nav).


[View source]
def shift? #

Returns true if this enum value contains Shift


[View source]
def super? #

Returns true if this enum value contains Super


[View source]