diff options
-rw-r--r-- | lib/reline/line_editor.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 0adda72b23..12a2bde234 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -344,8 +344,9 @@ class Reline::LineEditor else end_of_line_cursor = new_cursor_max end - line_to_calc.encode(Encoding::UTF_8).grapheme_clusters.each do |gc| - mbchar_width = Reline::Unicode.get_mbchar_width(gc) + line_to_calc.grapheme_clusters.each do |gc| + mbchar = gc.encode(Encoding::UTF_8) + mbchar_width = Reline::Unicode.get_mbchar_width(mbchar) now = new_cursor + mbchar_width if now > end_of_line_cursor or now > cursor break |