mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Operator with arg need to make sure that they take arg to avoid crashing
https://github.com/ruby/reline/commit/1c0c06de1f
This commit is contained in:
parent
92b22db6a7
commit
2dc4aca8d1
2 changed files with 14 additions and 1 deletions
|
@ -735,7 +735,7 @@ class Reline::LineEditor
|
|||
not_insertion = method_symbol != :ed_insert
|
||||
process_insert(force: not_insertion)
|
||||
end
|
||||
if @vi_arg
|
||||
if @vi_arg and argumentable?(method_obj)
|
||||
method_obj.(key, arg: @vi_arg)
|
||||
else
|
||||
method_obj.(key)
|
||||
|
|
|
@ -1228,6 +1228,19 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase
|
|||
assert_line('aaa bbb ___ ddd')
|
||||
end
|
||||
|
||||
def test_vi_delete_meta_with_arg
|
||||
input_keys("aaa bbb ccc\C-[02w")
|
||||
assert_byte_pointer_size('aaa bbb ')
|
||||
assert_cursor(8)
|
||||
assert_cursor_max(11)
|
||||
assert_line('aaa bbb ccc')
|
||||
input_keys('2dl') # TODO This should delete 2 chars.
|
||||
assert_byte_pointer_size('aaa bbb ')
|
||||
assert_cursor(8)
|
||||
assert_cursor_max(10)
|
||||
assert_line('aaa bbb cc')
|
||||
end
|
||||
|
||||
def test_vi_change_meta
|
||||
input_keys("aaa bbb ccc ddd eee\C-[02w")
|
||||
assert_byte_pointer_size('aaa bbb ')
|
||||
|
|
Loading…
Add table
Reference in a new issue