mini_readline 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -12
- data/lib/mini_readline/raw_term/other/map.rb +8 -0
- data/lib/mini_readline/raw_term/windows/map.rb +6 -0
- data/lib/mini_readline/read_line/edit.rb +3 -0
- data/lib/mini_readline/read_line/edit/word_left.rb +19 -0
- data/lib/mini_readline/read_line/edit/word_right.rb +21 -0
- data/lib/mini_readline/version.rb +1 -1
- data/mini_readline.gemspec +2 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93b007ca4b55761c9dc6f4ddae5e6d45bd118a63
|
4
|
+
data.tar.gz: d1f1f3750bbe1b621b8a2c624d6e009e40eec839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a2a9ff735c9918757542baf9ae5800d63154d0c0ad795f2b172ba4d7063de5bf89865efa42aa4c87929966e474e7c22ec9e87c5047b6bed730fd3568d09c114
|
7
|
+
data.tar.gz: ea4ef0dfc1a29f67dec243961bcee04e8f419098f6b3168ef966a01068ec6bc4eebd56f5386d3cbc9bf23d8e3286429fe63d2a876bdcb26ee54060f70c5c49cd
|
data/README.md
CHANGED
@@ -41,18 +41,20 @@ The mini_readline gem supports a simple set of editing commands. These vary
|
|
41
41
|
somewhat based on the system platform. The keyboard mappings (and alias
|
42
42
|
mappings) are listed below:
|
43
43
|
|
44
|
-
Editor Action | Windows Key
|
45
|
-
|
46
|
-
Enter | Enter
|
47
|
-
Left | Left Arrow,
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
Erase
|
44
|
+
Editor Action | Windows Key | Other Key
|
45
|
+
-----------------|----------------------------------|------------
|
46
|
+
Enter | Enter | Enter
|
47
|
+
Left | Left Arrow, Pad Left | Left Arrow
|
48
|
+
Word Left | Ctrl Left Arrow, Ctrl Pad Left | Ctrl Left Arrow, Ctrl-B, Alt-b
|
49
|
+
Right | Right Arrow, Pad Right | Right Arrow
|
50
|
+
Word Right | Ctrl Right Arrow, Ctrl Pad Right | Ctrl Right Arrow, Ctrl-F, Alt-f
|
51
|
+
Go to start | Home, Pad Home | Home, Ctrl-A
|
52
|
+
Go to end | End, Pad End | End, Ctrl-E
|
53
|
+
Previous History | Up Arrow, Pad Up | Up Arrow, Ctrl-R
|
54
|
+
Next History | Down Arrow, Pad Down | Down Arrow
|
55
|
+
Erase Left | Backspace | Backspace, Ctrl-H
|
56
|
+
Erase Right | Delete, Ctrl-Backspace | Delete, Ctrl-Backspace
|
57
|
+
Erase All | Escape | Ctrl-L
|
56
58
|
|
57
59
|
### Notes
|
58
60
|
* The label "Other" is an umbrella that bundles together the Linux, Mac,
|
@@ -12,10 +12,18 @@ module MiniReadline
|
|
12
12
|
MAP["\e[D"] = [:go_left]
|
13
13
|
MAP["\e[D"] = [:go_left]
|
14
14
|
|
15
|
+
MAP["\e[1;5D"] = [:word_left]
|
16
|
+
MAP["\x02"] = [:word_left]
|
17
|
+
MAP["\eb"] = [:word_left]
|
18
|
+
|
15
19
|
#Right Arrows
|
16
20
|
MAP["\e[C"] = [:go_right]
|
17
21
|
MAP["\eOC"] = [:go_right]
|
18
22
|
|
23
|
+
MAP["\e[1;5C"] = [:word_right]
|
24
|
+
MAP["\x06"] = [:word_right]
|
25
|
+
MAP["\ef"] = [:word_right]
|
26
|
+
|
19
27
|
#Up Arrows
|
20
28
|
MAP["\e[A"] = [:previous_history]
|
21
29
|
MAP["\eOA"] = [:previous_history]
|
@@ -14,10 +14,16 @@ module MiniReadline
|
|
14
14
|
MAP["\x00K"] = [:go_left]
|
15
15
|
MAP[pfx+"K"] = [:go_left]
|
16
16
|
|
17
|
+
MAP["\x00s"] = [:word_left]
|
18
|
+
MAP[pfx+"s"] = [:word_left]
|
19
|
+
|
17
20
|
#Right Arrows
|
18
21
|
MAP["\x00M"] = [:go_right]
|
19
22
|
MAP[pfx+"M"] = [:go_right]
|
20
23
|
|
24
|
+
MAP["\x00t"] = [:word_right]
|
25
|
+
MAP[pfx+"t"] = [:word_right]
|
26
|
+
|
21
27
|
#Up Arrows
|
22
28
|
MAP["\x00H"] = [:previous_history]
|
23
29
|
MAP[pfx+"H"] = [:previous_history]
|
@@ -7,7 +7,10 @@ require_relative 'edit/insert_text'
|
|
7
7
|
require_relative 'edit/enter'
|
8
8
|
|
9
9
|
require_relative 'edit/go_left'
|
10
|
+
require_relative 'edit/word_left'
|
11
|
+
|
10
12
|
require_relative 'edit/go_right'
|
13
|
+
require_relative 'edit/word_right'
|
11
14
|
|
12
15
|
require_relative 'edit/go_home'
|
13
16
|
require_relative 'edit/go_end'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
#* read_line/window/edit/word_left.rb - Process :word_left
|
4
|
+
module MiniReadline
|
5
|
+
|
6
|
+
#* read_line/window/edit/word_left.rb - Process :word_left
|
7
|
+
class Edit
|
8
|
+
|
9
|
+
#A little more to the left please!
|
10
|
+
def word_left(_keyboard_args)
|
11
|
+
if @edit_posn > 0
|
12
|
+
posn = @edit_buffer[0...@edit_posn].rstrip.rindex(' ')
|
13
|
+
@edit_posn = posn ? posn + 1 : 0
|
14
|
+
else
|
15
|
+
@term.beep
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
#* read_line/window/edit/word_right.rb - Process :word_right
|
4
|
+
module MiniReadline
|
5
|
+
|
6
|
+
#* read_line/window/edit/word_right.rb - Process :word_right
|
7
|
+
class Edit
|
8
|
+
|
9
|
+
#A little more to the right please!
|
10
|
+
def word_right(_keyboard_args)
|
11
|
+
len = edit_buffer.length
|
12
|
+
|
13
|
+
if @edit_posn < len
|
14
|
+
right = @edit_buffer[(@edit_posn+1)..-1]
|
15
|
+
@edit_posn = (posn = /\s\S/ =~ right) ? @edit_posn + posn + 2 : len
|
16
|
+
else
|
17
|
+
@term.beep
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/mini_readline.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["peter.c.camilleri@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = "A simplified replacement for readline."
|
13
|
-
spec.description = "A gem for console command entry with line edit
|
14
|
-
"history. This gem is like the standard readline "
|
13
|
+
spec.description = "[WIP] A gem for console command entry with line edit "+
|
14
|
+
"and history. This gem is like the standard readline " +
|
15
15
|
"gem except that it has been redesigned, simplified, " +
|
16
16
|
"and extensively cleaned up."
|
17
17
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_readline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
@@ -38,9 +38,9 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: A gem for console command entry with line edit and history. This
|
42
|
-
is like the standard readline gem except that it has been redesigned, simplified,
|
43
|
-
and extensively cleaned up.
|
41
|
+
description: "[WIP] A gem for console command entry with line edit and history. This
|
42
|
+
gem is like the standard readline gem except that it has been redesigned, simplified,
|
43
|
+
and extensively cleaned up."
|
44
44
|
email:
|
45
45
|
- peter.c.camilleri@gmail.com
|
46
46
|
executables: []
|
@@ -77,6 +77,8 @@ files:
|
|
77
77
|
- lib/mini_readline/read_line/edit/next_history.rb
|
78
78
|
- lib/mini_readline/read_line/edit/previous_history.rb
|
79
79
|
- lib/mini_readline/read_line/edit/unmapped.rb
|
80
|
+
- lib/mini_readline/read_line/edit/word_left.rb
|
81
|
+
- lib/mini_readline/read_line/edit/word_right.rb
|
80
82
|
- lib/mini_readline/read_line/edit_window.rb
|
81
83
|
- lib/mini_readline/read_line/edit_window/sync_cursor.rb
|
82
84
|
- lib/mini_readline/read_line/edit_window/sync_window.rb
|