diff options
author | aycabta <aycabta@gmail.com> | 2020-11-02 21:57:54 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-12-05 02:58:58 +0900 |
commit | 6be3b2da19a45e21c63ed0a9c51fa4e1a0d1bd08 (patch) | |
tree | 884823c985878c72aba957dfc19d3ba75e637fe0 /lib/reline/line_editor.rb | |
parent | 2dc4aca8d18ae8b5159da22c5d02b3052a7ac4ec (diff) |
[ruby/reline] Implement vi_yank
https://github.com/ruby/reline/commit/164aaf9a5f
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 86d57d905b..8425a475d6 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -2083,6 +2083,14 @@ class Reline::LineEditor end private def vi_yank(key) + @waiting_operator_proc = proc { |cursor_diff, byte_pointer_diff| + if byte_pointer_diff > 0 + cut = @line.byteslice(@byte_pointer, byte_pointer_diff) + elsif byte_pointer_diff < 0 + cut = @line.byteslice(@byte_pointer + byte_pointer_diff, -byte_pointer_diff) + end + copy_for_vi(cut) + } end private def vi_list_or_eof(key) |