reline 0.5.0 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reline/ansi.rb +12 -6
- data/lib/reline/general_io.rb +1 -0
- data/lib/reline/key_actor/emacs.rb +11 -11
- data/lib/reline/key_actor/vi_command.rb +23 -23
- data/lib/reline/key_actor/vi_insert.rb +2 -2
- data/lib/reline/line_editor.rb +443 -560
- data/lib/reline/terminfo.rb +7 -14
- data/lib/reline/unicode.rb +2 -2
- data/lib/reline/version.rb +1 -1
- data/lib/reline/windows.rb +1 -1
- data/lib/reline.rb +31 -42
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77e916d771c2f7219d8cba4be2e3b5e6102dddcb505b342375b8717e069caab1
|
4
|
+
data.tar.gz: ec4262c712ed77b4807255d12887542b37e74cf0e1ccf1dfef78d803d886ba17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b88eb00ce703b01f691c2fc780a7f9ff43fefdcc9d42d22122bba742ddc03b20db19ecca2c21082081f66d4993f70a3a4cb53ea50ed5a0255728635360c45c
|
7
|
+
data.tar.gz: eb4b51fb15f94e2c349fe4cf19c2d6426f7fdf0800320b89a14d66e6f18ea72f327d7792a8edb6d6034df708bb7c25fbffb625fe7cc03271efdb6662d9c90deb
|
data/lib/reline/ansi.rb
CHANGED
@@ -151,7 +151,11 @@ class Reline::ANSI
|
|
151
151
|
end
|
152
152
|
|
153
153
|
def self.with_raw_input
|
154
|
-
@@input.
|
154
|
+
if @@input.tty?
|
155
|
+
@@input.raw(intr: true) { yield }
|
156
|
+
else
|
157
|
+
yield
|
158
|
+
end
|
155
159
|
end
|
156
160
|
|
157
161
|
@@buf = []
|
@@ -159,11 +163,13 @@ class Reline::ANSI
|
|
159
163
|
unless @@buf.empty?
|
160
164
|
return @@buf.shift
|
161
165
|
end
|
162
|
-
until
|
163
|
-
timeout_second -= 0.
|
166
|
+
until @@input.wait_readable(0.01)
|
167
|
+
timeout_second -= 0.01
|
164
168
|
return nil if timeout_second <= 0
|
165
|
-
|
169
|
+
|
170
|
+
Reline.core.line_editor.handle_signal
|
166
171
|
end
|
172
|
+
c = @@input.getbyte
|
167
173
|
(c == 0x16 && @@input.raw(min: 0, time: 0, &:getbyte)) || c
|
168
174
|
rescue Errno::EIO
|
169
175
|
# Maybe the I/O has been closed.
|
@@ -309,7 +315,7 @@ class Reline::ANSI
|
|
309
315
|
end
|
310
316
|
|
311
317
|
def self.hide_cursor
|
312
|
-
if Reline::Terminfo.enabled?
|
318
|
+
if Reline::Terminfo.enabled? && Reline::Terminfo.term_supported?
|
313
319
|
begin
|
314
320
|
@@output.write Reline::Terminfo.tigetstr('civis')
|
315
321
|
rescue Reline::Terminfo::TerminfoError
|
@@ -321,7 +327,7 @@ class Reline::ANSI
|
|
321
327
|
end
|
322
328
|
|
323
329
|
def self.show_cursor
|
324
|
-
if Reline::Terminfo.enabled?
|
330
|
+
if Reline::Terminfo.enabled? && Reline::Terminfo.term_supported?
|
325
331
|
begin
|
326
332
|
@@output.write Reline::Terminfo.tigetstr('cnorm')
|
327
333
|
rescue Reline::Terminfo::TerminfoError
|
data/lib/reline/general_io.rb
CHANGED
@@ -49,13 +49,13 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
|
|
49
49
|
# 23 ^W
|
50
50
|
:em_kill_region,
|
51
51
|
# 24 ^X
|
52
|
-
:
|
52
|
+
:ed_unassigned,
|
53
53
|
# 25 ^Y
|
54
54
|
:em_yank,
|
55
55
|
# 26 ^Z
|
56
56
|
:ed_ignore,
|
57
57
|
# 27 ^[
|
58
|
-
:
|
58
|
+
:ed_unassigned,
|
59
59
|
# 28 ^\
|
60
60
|
:ed_ignore,
|
61
61
|
# 29 ^]
|
@@ -319,9 +319,9 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
|
|
319
319
|
# 158 M-^^
|
320
320
|
:ed_unassigned,
|
321
321
|
# 159 M-^_
|
322
|
-
:em_copy_prev_word,
|
323
|
-
# 160 M-SPACE
|
324
322
|
:ed_unassigned,
|
323
|
+
# 160 M-SPACE
|
324
|
+
:em_set_mark,
|
325
325
|
# 161 M-!
|
326
326
|
:ed_unassigned,
|
327
327
|
# 162 M-"
|
@@ -415,7 +415,7 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
|
|
415
415
|
# 206 M-N
|
416
416
|
:vi_search_next,
|
417
417
|
# 207 M-O
|
418
|
-
:
|
418
|
+
:ed_unassigned,
|
419
419
|
# 208 M-P
|
420
420
|
:vi_search_prev,
|
421
421
|
# 209 M-Q
|
@@ -431,15 +431,15 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
|
|
431
431
|
# 214 M-V
|
432
432
|
:ed_unassigned,
|
433
433
|
# 215 M-W
|
434
|
-
:
|
434
|
+
:ed_unassigned,
|
435
435
|
# 216 M-X
|
436
|
-
:ed_command,
|
437
|
-
# 217 M-Y
|
438
436
|
:ed_unassigned,
|
437
|
+
# 217 M-Y
|
438
|
+
:em_yank_pop,
|
439
439
|
# 218 M-Z
|
440
440
|
:ed_unassigned,
|
441
441
|
# 219 M-[
|
442
|
-
:
|
442
|
+
:ed_unassigned,
|
443
443
|
# 220 M-\
|
444
444
|
:ed_unassigned,
|
445
445
|
# 221 M-]
|
@@ -495,9 +495,9 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
|
|
495
495
|
# 246 M-v
|
496
496
|
:ed_unassigned,
|
497
497
|
# 247 M-w
|
498
|
-
:
|
498
|
+
:ed_unassigned,
|
499
499
|
# 248 M-x
|
500
|
-
:
|
500
|
+
:ed_unassigned,
|
501
501
|
# 249 M-y
|
502
502
|
:ed_unassigned,
|
503
503
|
# 250 M-z
|
@@ -17,7 +17,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
17
17
|
# 7 ^G
|
18
18
|
:ed_unassigned,
|
19
19
|
# 8 ^H
|
20
|
-
:
|
20
|
+
:ed_prev_char,
|
21
21
|
# 9 ^I
|
22
22
|
:ed_unassigned,
|
23
23
|
# 10 ^J
|
@@ -41,7 +41,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
41
41
|
# 19 ^S
|
42
42
|
:ed_ignore,
|
43
43
|
# 20 ^T
|
44
|
-
:
|
44
|
+
:ed_transpose_chars,
|
45
45
|
# 21 ^U
|
46
46
|
:vi_kill_line_prev,
|
47
47
|
# 22 ^V
|
@@ -51,7 +51,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
51
51
|
# 24 ^X
|
52
52
|
:ed_unassigned,
|
53
53
|
# 25 ^Y
|
54
|
-
:
|
54
|
+
:em_yank,
|
55
55
|
# 26 ^Z
|
56
56
|
:ed_unassigned,
|
57
57
|
# 27 ^[
|
@@ -75,7 +75,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
75
75
|
# 36 $
|
76
76
|
:ed_move_to_end,
|
77
77
|
# 37 %
|
78
|
-
:
|
78
|
+
:ed_unassigned,
|
79
79
|
# 38 &
|
80
80
|
:ed_unassigned,
|
81
81
|
# 39 '
|
@@ -89,11 +89,11 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
89
89
|
# 43 +
|
90
90
|
:ed_next_history,
|
91
91
|
# 44 ,
|
92
|
-
:
|
92
|
+
:ed_unassigned,
|
93
93
|
# 45 -
|
94
94
|
:ed_prev_history,
|
95
95
|
# 46 .
|
96
|
-
:
|
96
|
+
:ed_unassigned,
|
97
97
|
# 47 /
|
98
98
|
:vi_search_prev,
|
99
99
|
# 48 0
|
@@ -117,9 +117,9 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
117
117
|
# 57 9
|
118
118
|
:ed_argument_digit,
|
119
119
|
# 58 :
|
120
|
-
:
|
120
|
+
:ed_unassigned,
|
121
121
|
# 59 ;
|
122
|
-
:
|
122
|
+
:ed_unassigned,
|
123
123
|
# 60 <
|
124
124
|
:ed_unassigned,
|
125
125
|
# 61 =
|
@@ -157,21 +157,21 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
157
157
|
# 77 M
|
158
158
|
:ed_unassigned,
|
159
159
|
# 78 N
|
160
|
-
:
|
160
|
+
:ed_unassigned,
|
161
161
|
# 79 O
|
162
|
-
:
|
162
|
+
:ed_unassigned,
|
163
163
|
# 80 P
|
164
164
|
:vi_paste_prev,
|
165
165
|
# 81 Q
|
166
166
|
:ed_unassigned,
|
167
167
|
# 82 R
|
168
|
-
:
|
168
|
+
:ed_unassigned,
|
169
169
|
# 83 S
|
170
|
-
:
|
170
|
+
:ed_unassigned,
|
171
171
|
# 84 T
|
172
172
|
:vi_to_prev_char,
|
173
173
|
# 85 U
|
174
|
-
:
|
174
|
+
:ed_unassigned,
|
175
175
|
# 86 V
|
176
176
|
:ed_unassigned,
|
177
177
|
# 87 W
|
@@ -179,11 +179,11 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
179
179
|
# 88 X
|
180
180
|
:ed_delete_prev_char,
|
181
181
|
# 89 Y
|
182
|
-
:
|
182
|
+
:ed_unassigned,
|
183
183
|
# 90 Z
|
184
184
|
:ed_unassigned,
|
185
185
|
# 91 [
|
186
|
-
:
|
186
|
+
:ed_unassigned,
|
187
187
|
# 92 \
|
188
188
|
:ed_unassigned,
|
189
189
|
# 93 ]
|
@@ -191,7 +191,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
191
191
|
# 94 ^
|
192
192
|
:vi_first_print,
|
193
193
|
# 95 _
|
194
|
-
:
|
194
|
+
:ed_unassigned,
|
195
195
|
# 96 `
|
196
196
|
:ed_unassigned,
|
197
197
|
# 97 a
|
@@ -221,7 +221,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
221
221
|
# 109 m
|
222
222
|
:ed_unassigned,
|
223
223
|
# 110 n
|
224
|
-
:
|
224
|
+
:ed_unassigned,
|
225
225
|
# 111 o
|
226
226
|
:ed_unassigned,
|
227
227
|
# 112 p
|
@@ -231,11 +231,11 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
231
231
|
# 114 r
|
232
232
|
:vi_replace_char,
|
233
233
|
# 115 s
|
234
|
-
:
|
234
|
+
:ed_unassigned,
|
235
235
|
# 116 t
|
236
236
|
:vi_to_next_char,
|
237
237
|
# 117 u
|
238
|
-
:
|
238
|
+
:ed_unassigned,
|
239
239
|
# 118 v
|
240
240
|
:vi_histedit,
|
241
241
|
# 119 w
|
@@ -253,9 +253,9 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
253
253
|
# 125 }
|
254
254
|
:ed_unassigned,
|
255
255
|
# 126 ~
|
256
|
-
:vi_change_case,
|
257
|
-
# 127 ^?
|
258
256
|
:ed_unassigned,
|
257
|
+
# 127 ^?
|
258
|
+
:em_delete_prev_char,
|
259
259
|
# 128 M-^@
|
260
260
|
:ed_unassigned,
|
261
261
|
# 129 M-^A
|
@@ -415,7 +415,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
415
415
|
# 206 M-N
|
416
416
|
:ed_unassigned,
|
417
417
|
# 207 M-O
|
418
|
-
:
|
418
|
+
:ed_unassigned,
|
419
419
|
# 208 M-P
|
420
420
|
:ed_unassigned,
|
421
421
|
# 209 M-Q
|
@@ -439,7 +439,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
|
|
439
439
|
# 218 M-Z
|
440
440
|
:ed_unassigned,
|
441
441
|
# 219 M-[
|
442
|
-
:
|
442
|
+
:ed_unassigned,
|
443
443
|
# 220 M-\
|
444
444
|
:ed_unassigned,
|
445
445
|
# 221 M-]
|
@@ -41,7 +41,7 @@ class Reline::KeyActor::ViInsert < Reline::KeyActor::Base
|
|
41
41
|
# 19 ^S
|
42
42
|
:vi_search_next,
|
43
43
|
# 20 ^T
|
44
|
-
:
|
44
|
+
:ed_transpose_chars,
|
45
45
|
# 21 ^U
|
46
46
|
:vi_kill_line_prev,
|
47
47
|
# 22 ^V
|
@@ -51,7 +51,7 @@ class Reline::KeyActor::ViInsert < Reline::KeyActor::Base
|
|
51
51
|
# 24 ^X
|
52
52
|
:ed_insert,
|
53
53
|
# 25 ^Y
|
54
|
-
:
|
54
|
+
:em_yank,
|
55
55
|
# 26 ^Z
|
56
56
|
:ed_insert,
|
57
57
|
# 27 ^[
|