diff options
author | aycabta <[email protected]> | 2021-09-28 19:21:31 +0900 |
---|---|---|
committer | git <[email protected]> | 2021-09-29 22:07:49 +0900 |
commit | 5eb8b6d1bd1b711a47541de41a2747af82cb0aea () | |
tree | 463a2f5e0489f28857c33db904cbcb1f817f24f4 | |
parent | 0182bf615a6ef3fb0401a31b4f6840221af00db7 (diff) |
[ruby/reline] Support ed_argument_digit by M+num
The vi mode can handle "argument number" before an operator or a motion, such as, "3x" (equals "xxx"), and "3l" (equals "lll"). In the emacs mode, GNU Readline can handle argument number with meta key, like "Meta+3 x" (equals "xxx"). https://.com/ruby/reline/commit/9183cc2e8b
-rw-r--r-- | lib/reline/line_editor.rb | 13 | ||||
-rw-r--r-- | test/reline/test_key_actor_emacs.rb | 14 |
2 files changed, 25 insertions, 2 deletions
@@ -2494,7 +2494,7 @@ class Reline::LineEditor end end - private def em_delete_prev_char(key) if @is_multiline and @cursor == 0 and @line_index > 0 @buffer_of_lines[@line_index] = @line @cursor = calculate_width(@buffer_of_lines[@line_index - 1]) @@ -2512,6 +2512,8 @@ class Reline::LineEditor @cursor -= width @cursor_max -= width end end alias_method :backward_delete_char, :em_delete_prev_char @@ -3048,7 +3050,14 @@ class Reline::LineEditor private def ed_argument_digit(key) if @vi_arg.nil? - unless key.chr.to_i.zero? @vi_arg = key.chr.to_i end else @@ -2292,6 +2292,20 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_cursor_max(2) end def test_input_unknown_char input_keys('') # U+0378 (unassigned) assert_line('') |