summaryrefslogtreecommitdiff
path: root/test/reline/test_key_actor_vi.rb
diff options
context:
space:
mode:
authortomoya ishida <[email protected]>2024-12-06 16:09:19 +0900
committergit <[email protected]>2024-12-06 07:09:24 +0000
commit5f65321915843faf47231a941f284e7375d6fb10 (patch)
treee458e06a3c5a7212391e9a59b7eeee73cde0cf85 /test/reline/test_key_actor_vi.rb
parent6ccaa37eb365afd6b01359e63dac85aef35987a5 (diff)
[ruby/reline] Combine MAPPINGS(single byte input to symbol) with
key_bindings(escape sequence to symbol) (https://github.com/ruby/reline/pull/715) https://github.com/ruby/reline/commit/6a7e249374
Diffstat (limited to 'test/reline/test_key_actor_vi.rb')
-rw-r--r--test/reline/test_key_actor_vi.rb31
1 files changed, 25 insertions, 6 deletions
diff --git a/test/reline/test_key_actor_vi.rb b/test/reline/test_key_actor_vi.rb
index 9712ba89cc..6d5b7e20c4 100644
--- a/test/reline/test_key_actor_vi.rb
+++ b/test/reline/test_key_actor_vi.rb
@@ -112,6 +112,17 @@ class Reline::ViInsertTest < Reline::TestCase
assert_line_around_cursor("か\u3099き\u3099", '')
end
+ def test_ed_insert_ignore_in_vi_command
+ input_keys("\C-[")
+ chars_to_be_ignored = "\C-Oあ=".chars
+ input_keys(chars_to_be_ignored.join)
+ assert_line_around_cursor('', '')
+ input_keys(chars_to_be_ignored.map {|c| "5#{c}" }.join)
+ assert_line_around_cursor('', '')
+ input_keys('iい')
+ assert_line_around_cursor("い", '')
+ end
+
def test_ed_next_char
input_keys("abcdef\C-[0")
assert_line_around_cursor('', 'abcdef')
@@ -648,7 +659,7 @@ class Reline::ViInsertTest < Reline::TestCase
assert_line_around_cursor('Readline', '')
input_keys("\C-i", false)
assert_line_around_cursor('Regexp', '')
- @line_editor.input_key(Reline::Key.new(:completion_journey_up, :completion_journey_up, false))
+ input_key_by_symbol(:completion_journey_up)
assert_line_around_cursor('Readline', '')
ensure
@config.autocompletion = false
@@ -671,7 +682,7 @@ class Reline::ViInsertTest < Reline::TestCase
assert_line_around_cursor('Readline', '')
input_keys("\C-i", false)
assert_line_around_cursor('Regexp', '')
- @line_editor.input_key(Reline::Key.new(:menu_complete_backward, :menu_complete_backward, false))
+ input_key_by_symbol(:menu_complete_backward)
assert_line_around_cursor('Readline', '')
ensure
@config.autocompletion = false
@@ -804,6 +815,14 @@ class Reline::ViInsertTest < Reline::TestCase
assert_line_around_cursor(' f', 'oo foo')
end
+ def test_waiting_operator_arg_including_zero
+ input_keys("a111111111111222222222222\C-[0")
+ input_keys('10df1')
+ assert_line_around_cursor('', '11222222222222')
+ input_keys('d10f2')
+ assert_line_around_cursor('', '22')
+ end
+
def test_vi_waiting_operator_cancel
input_keys("aaa bbb ccc\C-[02w")
assert_line_around_cursor('aaa bbb ', 'ccc')
@@ -825,14 +844,14 @@ class Reline::ViInsertTest < Reline::TestCase
assert_line_around_cursor('', 'aaa bbb lll')
# ed_next_char should move cursor right and cancel vi_next_char
input_keys('f')
- input_key_by_symbol(:ed_next_char)
+ input_key_by_symbol(:ed_next_char, csi: true)
input_keys('l')
assert_line_around_cursor('aa', 'a bbb lll')
- # ed_next_char should move cursor right and cancel delete_meta
+ # vi_delete_meta + ed_next_char should delete character
input_keys('d')
- input_key_by_symbol(:ed_next_char)
+ input_key_by_symbol(:ed_next_char, csi: true)
input_keys('l')
- assert_line_around_cursor('aaa ', 'bbb lll')
+ assert_line_around_cursor('aa ', 'bbb lll')
end
def test_unimplemented_vi_command_should_be_no_op