keyboard_map 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25ca369fcb1d0e1d108dbeb543d3b0a284cfff550886c6ce5d1ee4857450ea58
4
- data.tar.gz: 67a599e04714db40a08f13c57203de64be1319a627505e88b47769cc96aacd2c
3
+ metadata.gz: 7f312919ed805b51ea0fb84ca84af658d8f790f39f8c4f03ddf757ba91c1ffe9
4
+ data.tar.gz: 8ab6d0f7568197bf1a0880903ec01f64c7c6b301b2ad2f6e370f3783d3ad15bc
5
5
  SHA512:
6
- metadata.gz: 3e8ff18adc0ce259a0570c552370adc5b06827f35fd57f759466e2efb913cb51144905268549dfaeea3fa81d3ae1e45d18856d5a20f1c3bd2daf1357362a4a1f
7
- data.tar.gz: 58975bc916c978e5778a4082960b00924d49d15ae7fc0e86d4c17df4e0a69e52072ca8a7ba2b86201dd3d99fa53678f98300374ea958c17708305304bcdf1fbb
6
+ metadata.gz: 3a49284ca89bd369926a3979ec168ce6b4da91f053ae4ede3c1ae32b59138bfab33c73ce53312d44012a47b4a43aa20e7b9864967db75be7c553b77446b70332
7
+ data.tar.gz: 62ff772c4d5c8ace33ff0b0d3a80518364a36436e9bda01afeafba243275562572771a3829b91756caa0e5703b0616f7c472db17af807ed92f789778bfbe5c51
data/lib/keyboard_map.rb CHANGED
@@ -35,6 +35,7 @@ class KeyboardMap
35
35
  SINGLE_KEY_EVENT = {
36
36
  "\t" => :tab,
37
37
  "\r" => :enter,
38
+ "\u001F" => Event.new(:_,:ctrl),
38
39
  "\u007F" => :backspace
39
40
  }.freeze
40
41
 
@@ -76,9 +77,18 @@ class KeyboardMap
76
77
  "201" => :end_paste,
77
78
  }.freeze
78
79
 
80
+ @@key_events = {}
81
+ def self.event(key,*modifiers)
82
+ e = key if key.kind_of?(Event)
83
+ e ||= Event.new(key,*modifiers)
84
+ k = e.to_sym
85
+ @@key_events[k] ||= e
86
+ @@key_events[k]
87
+ end
88
+
79
89
  # Map of simple/non-parameterised escape sequences to symbols
80
90
  ESCAPE_MAP = {
81
- "\e[Z" => Event.new(:tab,:shift),
91
+ "\e[Z" => event(:tab,:shift),
82
92
  "\eOP" => :f1,
83
93
  "\eOQ" => :f2,
84
94
  "\eOR" => :f3,
@@ -87,14 +97,6 @@ class KeyboardMap
87
97
 
88
98
  CSI_FINAL_BYTE = 0x40..0x7e
89
99
 
90
- @@key_events = {}
91
- def self.event(key,*modifiers)
92
- e = Event.new(key,*modifiers)
93
- k = e.to_sym
94
- @@key_events[k] ||= e
95
- @@key_events[k]
96
- end
97
-
98
100
  def meta(key)
99
101
  self.class.event(key,:meta)
100
102
  end
@@ -1,3 +1,3 @@
1
1
  class KeyboardMap
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keyboard_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vidar Hokstad