summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/reline/line_editor.rb3
-rw-r--r--test/reline/test_key_actor_vi.rb18
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 3ecaef15e1..474fe3ca55 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -2395,6 +2395,9 @@ class Reline::LineEditor
width = Reline::Unicode.get_mbchar_width(mbchar)
@cursor_max -= width
if @cursor > 0 and @cursor >= @cursor_max
+ byte_size = Reline::Unicode.get_prev_mbchar_size(@line, @byte_pointer)
+ mbchar = @line.byteslice(@byte_pointer - byte_size, byte_size)
+ width = Reline::Unicode.get_mbchar_width(mbchar)
@byte_pointer -= byte_size
@cursor -= width
end
diff --git a/test/reline/test_key_actor_vi.rb b/test/reline/test_key_actor_vi.rb
index 6ac776fd9d..c6cd5eff48 100644
--- a/test/reline/test_key_actor_vi.rb
+++ b/test/reline/test_key_actor_vi.rb
@@ -1434,4 +1434,22 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase
assert_cursor(4)
assert_cursor_max(4)
end
+
+ def test_ed_delete_next_char_at_eol
+ input_keys('"あ"')
+ assert_line('"あ"')
+ assert_byte_pointer_size('"あ"')
+ assert_cursor(4)
+ assert_cursor_max(4)
+ input_keys("\C-[")
+ assert_line('"あ"')
+ assert_byte_pointer_size('"あ')
+ assert_cursor(3)
+ assert_cursor_max(4)
+ input_keys('xa"')
+ assert_line('"あ"')
+ assert_byte_pointer_size('"あ"')
+ assert_cursor(4)
+ assert_cursor_max(4)
+ end
end