From 3bb503e0e8f92c039ce50f430b14649a36c03feb Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 16 Sep 2020 11:19:06 +0900 Subject: Merge Reline 0.1.5 --- lib/reline.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/reline.rb') 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) -- cgit v1.2.3