1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Use Reline::Unicode.take_range to devide exactly by width

https://github.com/ruby/reline/commit/de1ad93f44
This commit is contained in:
aycabta 2021-08-31 15:11:30 +09:00 committed by git
parent 4f5166e790
commit 7afb5b8b95

View file

@ -652,7 +652,7 @@ class Reline::LineEditor
bg_color = '46' bg_color = '46'
end end
end end
@output.write "\e[#{bg_color}m%-#{dialog.width}s\e[49m" % item.slice(0, dialog.width) @output.write "\e[#{bg_color}m%-#{dialog.width}s\e[49m" % Reline::Unicode.take_range(item, 0, dialog.width)
Reline::IOGate.move_cursor_column(dialog.column) Reline::IOGate.move_cursor_column(dialog.column)
move_cursor_down(1) if i < (dialog.contents.size - 1) move_cursor_down(1) if i < (dialog.contents.size - 1)
end end