[ruby/reline] Use UTF-8 only for width calc, rest uses original encoding
I confirmed that libvterm supports only which are UTF-8, US ASCII, UK, and DEC graphics by reading source code, so can't test this patch by yamatanoorogi gem through vterm gem for now. This fixes ruby/irb#190. https://github.com/ruby/reline/commit/44596c0cc7
This commit is contained in:
parent
38d30a6942
commit
aeac4ddcc0
@ -344,8 +344,9 @@ class Reline::LineEditor
|
|||||||
else
|
else
|
||||||
end_of_line_cursor = new_cursor_max
|
end_of_line_cursor = new_cursor_max
|
||||||
end
|
end
|
||||||
line_to_calc.encode(Encoding::UTF_8).grapheme_clusters.each do |gc|
|
line_to_calc.grapheme_clusters.each do |gc|
|
||||||
mbchar_width = Reline::Unicode.get_mbchar_width(gc)
|
mbchar = gc.encode(Encoding::UTF_8)
|
||||||
|
mbchar_width = Reline::Unicode.get_mbchar_width(mbchar)
|
||||||
now = new_cursor + mbchar_width
|
now = new_cursor + mbchar_width
|
||||||
if now > end_of_line_cursor or now > cursor
|
if now > end_of_line_cursor or now > cursor
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user