diff --git a/lib/reline.rb b/lib/reline.rb index 2b21968371..cafaf578a0 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -304,7 +304,6 @@ module Reline $stderr.reopen(ENV['RELINE_STDERR_TTY'], 'w') $stderr.sync = true end - @@config.read otio = Reline::IOGate.prep may_req_ambiguous_char_width @@ -324,9 +323,12 @@ module Reline @@line_editor.pre_input_hook = @@pre_input_hook @@line_editor.rerender - @@config.reset_default_key_bindings - Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func| - @@config.add_default_key_binding(key, func) + unless @@config.test_mode + @@config.read + @@config.reset_default_key_bindings + Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func| + @@config.add_default_key_binding(key, func) + end end key_stroke = Reline::KeyStroke.new(@@config) diff --git a/lib/reline/config.rb b/lib/reline/config.rb index 7639882027..b5ed6a89ba 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -78,7 +78,6 @@ class Reline::Config end def read(file = DEFAULT_PATH) - return if @test_mode file = ENV['INPUTRC'] if ENV['INPUTRC'] begin if file.respond_to?(:readlines) diff --git a/test/reline/test_within_pipe.rb b/test/reline/test_within_pipe.rb index 586e782be4..132fdcafbc 100644 --- a/test/reline/test_within_pipe.rb +++ b/test/reline/test_within_pipe.rb @@ -21,4 +21,10 @@ class Reline::WithinPipeTest < Reline::TestCase @writer.write("abc\n") assert_equal 'abc', Reline.readmultiline(&proc{ true }) end + + def test_unknown_macro + @config.add_default_key_binding('abc'.bytes, :unknown_macro) + @writer.write("abcd\n") + assert_equal 'd', Reline.readmultiline(&proc{ true }) + end end