summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-06-03 03:29:19 +0900
committeraycabta <aycabta@gmail.com>2019-06-03 03:29:34 +0900
commit3428922437a31b644cffcabd33fd9353e68f88c8 (patch)
treeb3bb1a594ec39d55dcf42a1d1cf30c2cadc7285b /lib
parent65fdb903250f37add2f83b81a5600d0c3e417427 (diff)
The ed_move_to_beg is different from vi_first_print
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/key_actor/vi_command.rb2
-rw-r--r--lib/reline/line_editor.rb6
-rw-r--r--lib/reline/unicode.rb2
3 files changed, 7 insertions, 3 deletions
diff --git a/lib/reline/key_actor/vi_command.rb b/lib/reline/key_actor/vi_command.rb
index 130fcb04a6..5a56fe5694 100644
--- a/lib/reline/key_actor/vi_command.rb
+++ b/lib/reline/key_actor/vi_command.rb
@@ -189,7 +189,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
# 93 ]
:ed_unassigned,
# 94 ^
- :ed_move_to_beg,
+ :vi_first_print,
# 95 _
:vi_history_word,
# 96 `
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index f3c24d9e02..6446879312 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1016,8 +1016,12 @@ class Reline::LineEditor
ed_prev_char(key, arg: arg) if arg > 0
end
+ private def vi_first_print(key)
+ @byte_pointer, @cursor = Reline::Unicode.vi_first_print(@line)
+ end
+
private def ed_move_to_beg(key)
- @byte_pointer, @cursor = Reline::Unicode.ed_move_to_begin(@line)
+ @byte_pointer = @cursor = 0
end
private def ed_move_to_end(key)
diff --git a/lib/reline/unicode.rb b/lib/reline/unicode.rb
index 448bdf1b52..5523d4fa31 100644
--- a/lib/reline/unicode.rb
+++ b/lib/reline/unicode.rb
@@ -407,7 +407,7 @@ class Reline::Unicode
[byte_size, width]
end
- def self.ed_move_to_begin(line)
+ def self.vi_first_print(line)
width = 0
byte_size = 0
while (line.bytesize - 1) > byte_size