diff options
author | aycabta <aycabta@gmail.com> | 2019-05-30 20:54:28 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-30 20:54:28 +0900 |
commit | 279c8e14d4b079e5b70b0389b82893de42b75c50 (patch) | |
tree | 4c6cdc5cac0b82617688d5f43322f5f979fb6816 /lib | |
parent | 74a0e3ec235380541db95e18978e4e1aa174b407 (diff) |
Use rebuilt buffer data to rerender all
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index a6d7ac5e0d..bc491a9038 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -392,7 +392,8 @@ class Reline::LineEditor move_cursor_up(@first_line_started_from + @started_from) Reline::IOGate.move_cursor_column(0) back = 0 - @buffer_of_lines.each do |line| + new_buffer = whole_lines + new_buffer.each do |line| width = prompt_width + calculate_width(line) height = calculate_height_by_width(width) back += height @@ -409,9 +410,9 @@ class Reline::LineEditor end move_cursor_up(@highest_in_all - 1) end - modify_lines(@buffer_of_lines).each_with_index do |line, index| + modify_lines(new_buffer).each_with_index do |line, index| render_partial(prompt, prompt_width, line, false) - if index < (@buffer_of_lines.size - 1) + if index < (new_buffer.size - 1) move_cursor_down(1) end end @@ -422,7 +423,7 @@ class Reline::LineEditor if @line_index.zero? 0 else - @buffer_of_lines[0..(@line_index - 1)].inject(0) { |result, line| + new_buffer[0..(@line_index - 1)].inject(0) { |result, line| result + calculate_height_by_width(@prompt_width + calculate_width(line)) } end |