summaryrefslogtreecommitdiff
path: root/lib/reline.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/reline.rb')
-rw-r--r--lib/reline.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/reline.rb b/lib/reline.rb
index 1537ee7e69..eb18d0d075 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -7,6 +7,7 @@ require 'reline/key_actor'
require 'reline/key_stroke'
require 'reline/line_editor'
require 'reline/history'
+require 'rbconfig'
module Reline
FILENAME_COMPLETION_PROC = nil
@@ -98,22 +99,22 @@ module Reline
end
def completion_proc=(p)
- raise ArgumentError unless p.respond_to?(:call)
+ raise ArgumentError unless p.respond_to?(:call) or p.nil?
@completion_proc = p
end
def output_modifier_proc=(p)
- raise ArgumentError unless p.respond_to?(:call)
+ raise ArgumentError unless p.respond_to?(:call) or p.nil?
@output_modifier_proc = p
end
def prompt_proc=(p)
- raise ArgumentError unless p.respond_to?(:call)
+ raise ArgumentError unless p.respond_to?(:call) or p.nil?
@prompt_proc = p
end
def auto_indent_proc=(p)
- raise ArgumentError unless p.respond_to?(:call)
+ raise ArgumentError unless p.respond_to?(:call) or p.nil?
@auto_indent_proc = p
end
@@ -122,7 +123,7 @@ module Reline
end
def dig_perfect_match_proc=(p)
- raise ArgumentError unless p.respond_to?(:call)
+ raise ArgumentError unless p.respond_to?(:call) or p.nil?
@dig_perfect_match_proc = p
end
@@ -222,7 +223,6 @@ module Reline
line_editor.auto_indent_proc = auto_indent_proc
line_editor.dig_perfect_match_proc = dig_perfect_match_proc
line_editor.pre_input_hook = pre_input_hook
- line_editor.rerender
unless config.test_mode
config.read
@@ -232,6 +232,8 @@ module Reline
end
end
+ line_editor.rerender
+
begin
loop do
read_io(config.keyseq_timeout) { |inputs|
@@ -243,6 +245,8 @@ module Reline
break if line_editor.finished?
end
Reline::IOGate.move_cursor_column(0)
+ rescue Errno::EIO
+ # Maybe the I/O has been closed.
rescue StandardError => e
line_editor.finalize
Reline::IOGate.deprep(otio)