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 +4 -4
- data/lib/keyboard_map.rb +11 -9
- data/lib/keyboard_map/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f312919ed805b51ea0fb84ca84af658d8f790f39f8c4f03ddf757ba91c1ffe9
|
4
|
+
data.tar.gz: 8ab6d0f7568197bf1a0880903ec01f64c7c6b301b2ad2f6e370f3783d3ad15bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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" =>
|
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
|
data/lib/keyboard_map/version.rb
CHANGED