diff options
author | ima1zumi <mariimaizumi5@gmail.com> | 2021-12-30 11:16:15 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-30 20:23:58 +0900 |
commit | f589242e750939eecf2a140fa3182dc5e387f157 (patch) | |
tree | 23f660d7da15bc520a64d483cd9af00976ea30e2 | |
parent | 8727161fcf51a3d9157755f410fc3af68bcd29f0 (diff) | |
download | ruby-f589242e750939eecf2a140fa3182dc5e387f157.tar.gz |
[ruby/reline] Use unix_line_discard when Ctrl-u is entered
The kill-line was called when C-u was entered, so it is now called unix-line-discard.
In readline(3):
> unix-line-discard (C-u)
> Kill backward from point to the beginning of the line.
> The killed text is saved on the kill-ring.
https://github.com/ruby/reline/commit/27570d195e
-rw-r--r-- | lib/reline/key_actor/emacs.rb | 2 | ||||
-rw-r--r-- | test/reline/test_key_actor_emacs.rb | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/lib/reline/key_actor/emacs.rb b/lib/reline/key_actor/emacs.rb index 86e39b705c..a561feee57 100644 --- a/lib/reline/key_actor/emacs.rb +++ b/lib/reline/key_actor/emacs.rb @@ -43,7 +43,7 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base # 20 ^T :ed_transpose_chars, # 21 ^U - :ed_kill_line, + :unix_line_discard, # 22 ^V :ed_quoted_insert, # 23 ^W diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index a5fdf247c8..40b26e5058 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -2329,4 +2329,26 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_cursor(1) assert_cursor_max(1) end + + def test_unix_line_discard + input_keys("\C-u", false) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + assert_line('') + input_keys('abc') + assert_byte_pointer_size('abc') + assert_cursor(3) + assert_cursor_max(3) + input_keys("\C-b\C-u", false) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(1) + assert_line('c') + input_keys("\C-f\C-u", false) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + assert_line('') + end end |