mini_readline 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49530157789ab808b51ed285303033e419bad8a6
4
- data.tar.gz: 06ecd307b10f8fa798f93ead6ddb4cd0fbf32234
3
+ metadata.gz: 93b007ca4b55761c9dc6f4ddae5e6d45bd118a63
4
+ data.tar.gz: d1f1f3750bbe1b621b8a2c624d6e009e40eec839
5
5
  SHA512:
6
- metadata.gz: b710a53e99d8bd01d49a098a727ce97fa0186b25a22f93babb490b32d3484c315971a7eec1647bb42be050da2e55bb91eee6b207486568d976e0fae9e9d198a9
7
- data.tar.gz: 3e256317645e657a4694f135bb40d833f8af8d99e820ad008712a16817cbe877d53b443f97b89a48e915c69e392af55053b91bf05400a7df5b687f8b9267773f
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 | Other Key
45
- -----------------|---------------------------|------------
46
- Enter | Enter | Enter
47
- Left | Left Arrow, Keypad Left | Left Arrow
48
- Right | Right Arrow, Keypad Right | Right Arrow
49
- Go to start | Home, Keypad Home | Home, Ctrl-A
50
- Go to end | End, Keypad End | End, Ctrl-E
51
- Previous History | Up Arrow, Keypad Up | Up Arrow, Ctrl-R
52
- Next History | Down Arrow, Keypad Down | Down Arrow
53
- Erase Left | Backspace | Backspace, Ctrl-H
54
- Erase Right | Delete, Ctrl-Backspace | Delete, Ctrl-Backspace
55
- Erase All | Escape | Ctrl-L
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
@@ -1,4 +1,4 @@
1
1
  module MiniReadline
2
2
  #The current version of the mini_readline gem.
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
@@ -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 and " +
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.3
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 gem
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