module RatatuiRuby::Event::Key::Modifier
Methods and logic for modifier keys.
Public Instance Methods
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 22 def alt? @modifiers.include?("alt") || @code == "left_alt" || @code == "right_alt" end
Returns true if ALT is held OR if this is a left_alt/right_alt key event.
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 14 def ctrl? @modifiers.include?("ctrl") || @code == "left_control" || @code == "right_control" end
Returns true if CTRL is held OR if this is a left_control/right_control key event.
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 52 def hyper? @modifiers.include?("hyper") || @code == "left_hyper" || @code == "right_hyper" end
Returns true if HYPER is held OR if this is a left_hyper/right_hyper key event.
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 57 def meta? @modifiers.include?("meta") || @code == "left_meta" || @code == "right_meta" end
Returns true if META is held OR if this is a left_meta/right_meta key event.
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 82 def modifier? @kind == :modifier end
Returns true if this is a modifier key event.
Some applications need to know if an event represents a generic key press or a specific modifier key (like CTRL or ALT) being pressed on its own.
This method identifies if the key event itself is a modifier key.
Example
if event.modifier? # Handle solo modifier key press end
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 30 def shift? @modifiers.include?("shift") || @code == "left_shift" || @code == "right_shift" end
Returns true if SHIFT is held OR if this is a left_shift/right_shift key event.
Source
# File lib/ratatui_ruby/event/key/modifier.rb, line 36 def super? @modifiers.include?("super") || @code == "left_super" || @code == "right_super" end
Returns true if SUPER is held OR if this is a left_super/right_super key event. Also responds to platform aliases: win?, command?, cmd?, tux?