diff options
author | aycabta <aycabta@gmail.com> | 2021-01-09 02:13:23 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-01-13 01:12:54 +0900 |
commit | eb5a094fc0231ccff080021aef23b19271761da1 (patch) | |
tree | 8395399a4907f4937dc9c6f88394421c7b3b2c24 /lib | |
parent | 44817db28bfc9a426732977893229e018687919d (diff) | |
download | ruby-eb5a094fc0231ccff080021aef23b19271761da1.tar.gz |
[ruby/reline] Move the cursor correctly when deleting at eol
This fixes ruby/reline#246.
https://github.com/ruby/reline/commit/07a73ba601
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 3 |
1 files changed, 3 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 |