diff options
author | aycabta <aycabta@gmail.com> | 2021-09-08 03:18:22 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-09-08 03:34:40 +0900 |
commit | 11a00e3fa2cdae7e65334097dc614ebe0c625e55 (patch) | |
tree | c58a8284c57ece427243201e0a60e880fa55fe1e /lib/reline/line_editor.rb | |
parent | 258661409e9e3fd470f006975ded872778aad4f4 (diff) | |
download | ruby-11a00e3fa2cdae7e65334097dc614ebe0c625e55.tar.gz |
[ruby/reline] Remove garbage left behind when rerendering the right side of the dialog
https://github.com/ruby/reline/commit/d89c23e30b
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 21c031d57a..7afc3ed1b0 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -706,7 +706,8 @@ class Reline::LineEditor bg_color = '46' end end - str = padding_space_with_escape_sequences(Reline::Unicode.take_range(item, 0, dialog.width - @block_elem_width), dialog.width - @block_elem_width) + str_width = dialog.width - (dialog.scrollbar_pos.nil? ? 0 : @block_elem_width) + str = padding_space_with_escape_sequences(Reline::Unicode.take_range(item, 0, str_width), str_width) @output.write "\e[#{bg_color}m#{str}" if dialog.scrollbar_pos and dialog.scrollbar_pos != old_dialog.scrollbar_pos @output.write "\e[37m" @@ -815,7 +816,7 @@ class Reline::LineEditor if (old_dialog.column + old_dialog.width - old_dialog_scrollbar) > (dialog.column + dialog.width - dialog_scrollbar) # rerender right move_cursor_down(old_dialog.vertical_offset + y_diff) - width = (old_dialog.column + old_dialog.width) - (dialog.column + dialog.width) + width = (old_dialog.column + old_dialog.width - old_dialog_scrollbar) - (dialog.column + dialog.width - dialog_scrollbar) start = visual_start + old_dialog.vertical_offset line_num = old_dialog.contents.size line_num.times do |i| @@ -826,7 +827,7 @@ class Reline::LineEditor s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column + dialog.width, width) s = padding_space_with_escape_sequences(s, dialog.width) end - Reline::IOGate.move_cursor_column(dialog.column + dialog.width) + Reline::IOGate.move_cursor_column(dialog.column + dialog.width - dialog_scrollbar) @output.write "\e[39m\e[49m#{s}\e[39m\e[49m" move_cursor_down(1) if i < (line_num - 1) end |