keyboard_map 0.1.1 → 0.1.3
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/version.rb +1 -1
- data/lib/keyboard_map.rb +13 -6
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad97855210bbcfc5569c0e179eccd55e03429b114b148c5222dede98f06d9a44
|
4
|
+
data.tar.gz: d604867d99759803d8c1dedda23ac64f328f51a538015655e661db286f6cb5b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bcdbdd51c0696d7622c8e6bb2ffb189db619c4e72d45b5019773908949750413322d6c695a89b7352e0dff715942d7d8b8816d841b7c59489f40f0fb3662858
|
7
|
+
data.tar.gz: 822319cc6e5c2596d4ec04d86af0d14de91dc32a9a2142dccf8928454fb276c395bd918eb1ed026a0f362d908587468d16b9cb3bfeebd8645279d57716672012
|
data/lib/keyboard_map/version.rb
CHANGED
data/lib/keyboard_map.rb
CHANGED
@@ -8,12 +8,12 @@ class KeyboardMap
|
|
8
8
|
attr_reader :buf
|
9
9
|
|
10
10
|
class Event
|
11
|
-
attr_reader :modifiers,:key
|
11
|
+
attr_reader :modifiers,:key, :args
|
12
12
|
|
13
|
-
|
14
|
-
def initialize(key,*modifiers)
|
13
|
+
def initialize(key, *modifiers, args: nil)
|
15
14
|
@modifiers = Set[*modifiers.map(&:to_sym)]
|
16
15
|
@key = key
|
16
|
+
@args = args
|
17
17
|
end
|
18
18
|
|
19
19
|
def to_sym
|
@@ -49,16 +49,19 @@ class KeyboardMap
|
|
49
49
|
"E" => :keypad_5,
|
50
50
|
"F" => :end,
|
51
51
|
"H" => :home,
|
52
|
-
"
|
52
|
+
"J" => :ctrl_end, # st reports this
|
53
|
+
"L" => :ctrl_insert, # st reports this
|
54
|
+
"P" => :delete,
|
53
55
|
"Q" => :f2,
|
54
56
|
"R" => :f3,
|
55
|
-
"S" => :f4
|
57
|
+
"S" => :f4
|
56
58
|
}.freeze
|
57
59
|
|
58
60
|
# \e[{parameter1}{;...}~ from parameter1 => key
|
59
61
|
CSI_TILDE_MAP = {
|
60
62
|
"2" => :insert,
|
61
63
|
"3" => :delete,
|
64
|
+
"4" => :end, # st reports this
|
62
65
|
"5" => :page_up,
|
63
66
|
"6" => :page_down,
|
64
67
|
"11" => :f1,
|
@@ -92,7 +95,9 @@ class KeyboardMap
|
|
92
95
|
"\eOP" => :f1,
|
93
96
|
"\eOQ" => :f2,
|
94
97
|
"\eOR" => :f3,
|
95
|
-
"\eOS" => :f4
|
98
|
+
"\eOS" => :f4,
|
99
|
+
"\e[M" => event(:delete,:ctrl), # st reports this
|
100
|
+
"\e[4h" => :insert # st reports this
|
96
101
|
}.freeze
|
97
102
|
|
98
103
|
CSI_FINAL_BYTE = 0x40..0x7e
|
@@ -151,6 +156,8 @@ class KeyboardMap
|
|
151
156
|
if key
|
152
157
|
modifiers = map_modifiers(params[1])
|
153
158
|
end
|
159
|
+
elsif final == "m" || final == "M" # Mouse reporting
|
160
|
+
return Event.new(final == "M" ? :mouse_down : :mouse_up, args: [params[0][1..-1].to_i, params[1].to_i, params[2].to_i])
|
154
161
|
else
|
155
162
|
key = CSI_BASIC_MAP[final]
|
156
163
|
modifiers = map_modifiers(params[1]) if key && params.first == "1" && params.size == 2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keyboard_map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vidar Hokstad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
|
94
|
-
rubygems_version: 2.7.6
|
93
|
+
rubygems_version: 3.1.4
|
95
94
|
signing_key:
|
96
95
|
specification_version: 4
|
97
96
|
summary: Read characters from the console and map special keys to symbols
|