aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-11-02 15:22:11 +0900
committeraycabta <aycabta@gmail.com>2020-12-05 02:58:58 +0900
commit92b22db6a7d943328ef2776fb3b6a6924fc8b496 (patch)
treeb2ceba8ebef86c9fc18eddd9dd5d3eb0a1e23a1b
parentfaf8f216be034a575350c7f3387992930b224bfc (diff)
downloadruby-92b22db6a7d943328ef2776fb3b6a6924fc8b496.tar.gz
[ruby/reline] Unimplemented vi command should be no-op
https://github.com/ruby/reline/commit/abc90e6867
-rw-r--r--lib/reline/line_editor.rb4
-rw-r--r--test/reline/test_key_actor_vi.rb13
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 17fabd175d..f6cf0c5280 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -771,7 +771,7 @@ class Reline::LineEditor
elsif method_obj
wrap_method_call(method_symbol, method_obj, key)
else
- ed_insert(key)
+ ed_insert(key) unless @config.editing_mode_is?(:vi_command)
end
@kill_ring.process
@vi_arg = nil
@@ -789,7 +789,7 @@ class Reline::LineEditor
end
@kill_ring.process
else
- ed_insert(key)
+ ed_insert(key) unless @config.editing_mode_is?(:vi_command)
end
end
diff --git a/test/reline/test_key_actor_vi.rb b/test/reline/test_key_actor_vi.rb
index c09c93691a..f5e542fbbe 100644
--- a/test/reline/test_key_actor_vi.rb
+++ b/test/reline/test_key_actor_vi.rb
@@ -1250,4 +1250,17 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase
assert_cursor_max(16)
assert_line('aaa bbb ddd eee')
end
+
+ def test_unimplemented_vi_command_should_be_no_op
+ input_keys("abc\C-[h")
+ assert_byte_pointer_size('a')
+ assert_cursor(1)
+ assert_cursor_max(3)
+ assert_line('abc')
+ input_keys('@')
+ assert_byte_pointer_size('a')
+ assert_cursor(1)
+ assert_cursor_max(3)
+ assert_line('abc')
+ end
end