highline 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
+ == 1.6.2
6
+
7
+ * Correctly handle STDIN being closed before we receive any data (fix by
8
+ mleinart).
9
+ * Try if msvcrt, if we can't load crtdll on Windows (fix by pepijnve).
10
+ * A fix for nil_on_handled not running the action (reported by Andrew Davey).
11
+
5
12
  == 1.6.1
6
13
 
7
14
  * Fixed raw_no_echo_mode so that it uses stty -icanon rather than cbreak
@@ -29,7 +29,7 @@ require "highline/color_scheme"
29
29
  #
30
30
  class HighLine
31
31
  # The version of the installed library.
32
- VERSION = "1.6.1".freeze
32
+ VERSION = "1.6.2".freeze
33
33
 
34
34
  # An internal HighLine error. User code does not need to trap this.
35
35
  class QuestionError < StandardError
@@ -591,9 +591,16 @@ class HighLine
591
591
  # work-around ugly readline() warnings
592
592
  old_verbose = $VERBOSE
593
593
  $VERBOSE = nil
594
+ raw_answer = Readline.readline(question, true)
595
+ if raw_answer.nil?
596
+ if @@track_eof
597
+ raise EOFError, "The input stream is exhausted."
598
+ else
599
+ raw_answer = String.new # Never return nil
600
+ end
601
+ end
594
602
  answer = @question.change_case(
595
- @question.remove_whitespace(
596
- Readline.readline(question, true) ) )
603
+ @question.remove_whitespace(raw_answer))
597
604
  $VERBOSE = old_verbose
598
605
 
599
606
  answer
@@ -306,13 +306,14 @@ class HighLine
306
306
  end
307
307
 
308
308
  # Run or return it.
309
- if not @nil_on_handled and not action.nil?
309
+ if not action.nil?
310
310
  @highline = highline_context
311
311
  if @shell
312
- action.call(name, details)
312
+ result = action.call(name, details)
313
313
  else
314
- action.call(name)
314
+ result = action.call(name)
315
315
  end
316
+ @nil_on_handled ? nil : result
316
317
  elsif action.nil?
317
318
  name
318
319
  else
@@ -35,6 +35,8 @@ class HighLine
35
35
  # character from +STDIN+!
36
36
  #
37
37
  def get_character( input = STDIN )
38
+ Win32API.new("msvcrt", "_getch", [ ], "L").Call
39
+ rescue Exception
38
40
  Win32API.new("crtdll", "_getch", [ ], "L").Call
39
41
  end
40
42
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highline
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 6
9
- - 1
10
- version: 1.6.1
4
+ prerelease:
5
+ version: 1.6.2
11
6
  platform: ruby
12
7
  authors:
13
8
  - James Edward Gray II
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-07-15 00:00:00 -05:00
13
+ date: 2011-05-13 00:00:00 -05:00
19
14
  default_executable:
20
15
  dependencies: []
21
16
 
@@ -84,23 +79,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
79
  requirements:
85
80
  - - ">="
86
81
  - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
82
  version: "0"
91
83
  required_rubygems_version: !ruby/object:Gem::Requirement
92
84
  none: false
93
85
  requirements:
94
86
  - - ">="
95
87
  - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
88
  version: "0"
100
89
  requirements: []
101
90
 
102
91
  rubyforge_project: highline
103
- rubygems_version: 1.3.7
92
+ rubygems_version: 1.6.2
104
93
  signing_key:
105
94
  specification_version: 3
106
95
  summary: HighLine is a high-level command-line IO library.