[ruby/reline] Calc width including escape sequences and padding with spaces correctly
https://github.com/ruby/reline/commit/21c795e97f
This commit is contained in:
parent
3bd3adde7c
commit
a669b9661e
@ -651,7 +651,9 @@ class Reline::LineEditor
|
||||
bg_color = '46'
|
||||
end
|
||||
end
|
||||
@output.write "\e[#{bg_color}m%-#{dialog.width}s\e[49m" % Reline::Unicode.take_range(item, 0, dialog.width)
|
||||
str = Reline::Unicode.take_range(item, 0, dialog.width)
|
||||
str += ' ' * (dialog.width - calculate_width(str, true))
|
||||
@output.write "\e[#{bg_color}m#{str}\e[49m"
|
||||
Reline::IOGate.move_cursor_column(dialog.column)
|
||||
move_cursor_down(1) if i < (dialog.contents.size - 1)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user