Fix strange vertical cursor moving when adding a newline at bottom

This commit is contained in:
aycabta 2019-05-30 18:20:59 +09:00
Родитель 106843d839
Коммит fcca39fa73
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -360,8 +360,12 @@ class Reline::LineEditor
back = 0
modify_lines(new_lines).each_with_index do |line, index|
height = render_partial(prompt, prompt_width, line, false)
move_cursor_down(1)
back += height
if index < (new_lines.size - 1)
scroll_down(1)
back += height
else
back += height - 1
end
end
move_cursor_up(back)
if @previous_line_index