Class: TuiTui::KeyIntent

Inherits:
Object
  • Object
show all
Defined in:
lib/tui_tui/key_intent.rb

Overview

Shared navigation intent mapping for widgets.

Constant Summary collapse

{
  :up => :up,
  "k" => :up,
  :down => :down,
  "j" => :down,
  :home => :top,
  "g" => :top,
  :end => :bottom,
  "G" => :bottom
}.freeze
CANCEL =
[:escape, "q", KeyCode::CTRL_C].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for(key) ⇒ Object



21
# File 'lib/tui_tui/key_intent.rb', line 21

def self.for(key) = new.for(key)

Instance Method Details

#for(key) ⇒ Object



23
24
25
26
27
# File 'lib/tui_tui/key_intent.rb', line 23

def for(key)
  return :cancel if CANCEL.include?(key)

  NAVIGATION[key]
end