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

Use rebuilt buffer data to rerender all

This commit is contained in:
aycabta 2019-05-30 20:54:28 +09:00
parent 74a0e3ec23
commit 279c8e14d4

View file

@ -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