mini_readline 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18650c39506de94d12cb3f292413549722ec55fb
4
- data.tar.gz: 7cba8a96b929d75870ee5eeb5b7f20d0b0eb04c8
3
+ metadata.gz: 49530157789ab808b51ed285303033e419bad8a6
4
+ data.tar.gz: 06ecd307b10f8fa798f93ead6ddb4cd0fbf32234
5
5
  SHA512:
6
- metadata.gz: b859c1130980260216186916fb5f23a3375ac1973fb3748cebe665890684a2a63dee2edabf771974ddb67049722902709583d93164f25d3bff328b10216b2ce1
7
- data.tar.gz: de055b2fb3843cea35b0358d8f6f735d1c90591f714b69b26f1a2511985676b002e4bf6beddf028691059e35e7f4bce9e5ae409b5e24a4dfd84884db07cf0b16
6
+ metadata.gz: b710a53e99d8bd01d49a098a727ce97fa0186b25a22f93babb490b32d3484c315971a7eec1647bb42be050da2e55bb91eee6b207486568d976e0fae9e9d198a9
7
+ data.tar.gz: 3e256317645e657a4694f135bb40d833f8af8d99e820ad008712a16817cbe877d53b443f97b89a48e915c69e392af55053b91bf05400a7df5b687f8b9267773f
data/README.md CHANGED
@@ -52,7 +52,7 @@ Previous History | Up Arrow, Keypad Up | Up Arrow, Ctrl-R
52
52
  Next History | Down Arrow, Keypad Down | Down Arrow
53
53
  Erase Left | Backspace | Backspace, Ctrl-H
54
54
  Erase Right | Delete, Ctrl-Backspace | Delete, Ctrl-Backspace
55
- Erase All | Escape | Ctrl-B
55
+ Erase All | Escape | Ctrl-L
56
56
 
57
57
  ### Notes
58
58
  * The label "Other" is an umbrella that bundles together the Linux, Mac,
@@ -47,6 +47,6 @@ module MiniReadline
47
47
  MAP["\x0D"] = [:enter]
48
48
 
49
49
  #The Cancel key
50
- MAP["\x02"] = [:cancel]
50
+ MAP["\f"] = [:cancel]
51
51
  end
52
52
  end
@@ -28,6 +28,13 @@ module MiniReadline
28
28
  #Home the cursor and start at a known state.
29
29
  def initialize_parms
30
30
  put_string CARRIAGE_RETURN
31
+ STDIN.raw!
32
+ end
33
+
34
+ #Conclude the terminal state.
35
+ def conclude
36
+ STDIN.cooked!
37
+ print("\n")
31
38
  end
32
39
 
33
40
  #Sound a beep
@@ -45,6 +45,11 @@ module MiniReadline
45
45
  put_string CARRIAGE_RETURN
46
46
  end
47
47
 
48
+ #Conclude the terminal state.
49
+ def conclude
50
+ print("\n")
51
+ end
52
+
48
53
  #Sound a beep
49
54
  def beep
50
55
  @_beep.call(0)
@@ -21,11 +21,6 @@ module MiniReadline
21
21
  def get_mapped_keystroke
22
22
  MAP.get_mapped_keystroke {get_raw_char}
23
23
  end
24
-
25
- #Start on a new line.
26
- def put_new_line
27
- print("\n")
28
- end
29
24
  end
30
25
 
31
26
  #Select the type of platform in use.
@@ -30,9 +30,9 @@ module MiniReadline
30
30
  #* options - A hash of options; Typically :symbol => value
31
31
  def readline(prompt, options = {})
32
32
  initialize_parms(prompt, options)
33
- result = @edit.edit_process
34
- @term.put_new_line
35
- result
33
+ @edit.edit_process
34
+ ensure
35
+ @term.conclude
36
36
  end
37
37
 
38
38
  #Initialize the read line process. This basically process the arguments
@@ -1,4 +1,4 @@
1
1
  module MiniReadline
2
2
  #The current version of the mini_readline gem.
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_readline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-10 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler