ruby-changes:63932
From: aycabta <ko1@a...>
Date: Sat, 5 Dec 2020 03:09:29 +0900 (JST)
Subject: [ruby-changes:63932] 2dc4aca8d1 (master): [ruby/reline] Operator with arg need to make sure that they take arg to avoid crashing
https://git.ruby-lang.org/ruby.git/commit/?id=2dc4aca8d1 From 2dc4aca8d18ae8b5159da22c5d02b3052a7ac4ec Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 2 Nov 2020 14:55:15 +0900 Subject: [ruby/reline] Operator with arg need to make sure that they take arg to avoid crashing https://github.com/ruby/reline/commit/1c0c06de1f diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index f6cf0c5..86d57d9 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -735,7 +735,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L735 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) diff --git a/test/reline/test_key_actor_vi.rb b/test/reline/test_key_actor_vi.rb index f5e542f..a244927 100644 --- a/test/reline/test_key_actor_vi.rb +++ b/test/reline/test_key_actor_vi.rb @@ -1228,6 +1228,19 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_key_actor_vi.rb#L1228 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 ') -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/