diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index c8b251f78e..d8af20e54c 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -968,6 +968,8 @@ def wrap_method_call(method_symbol, key, with_operator) return unless respond_to?(method_symbol, true) method_obj = method(method_symbol) + # Not an editing function, e.g. Kernel#exit bound in inputrc + return if Object <= method_obj.owner if @vi_arg and argumentable?(method_obj) if inclusive?(method_obj) method_obj.(key, arg: @vi_arg, inclusive: with_operator) diff --git a/test/reline/test_macro.rb b/test/reline/test_macro.rb index cacdb76c60..60badd0579 100644 --- a/test/reline/test_macro.rb +++ b/test/reline/test_macro.rb @@ -37,4 +37,13 @@ class << @line_editor } assert_equal 'ab', @line_editor.line end + + def test_ignore_method_inherited_from_object + input('abc') + assert_nothing_raised { + input_key("\C-d", :exit) + input_key("\C-d", :sleep) + } + assert_equal 'abc', @line_editor.line + end end