From 5a229b0a88679529a18aa3ef87317bdbd1783c58 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 30 May 2019 15:19:30 +0900 Subject: [PATCH] Calculate vertical position correctly when rerendering all lines --- lib/reline/line_editor.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 088d220916..e84d087ac1 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -422,7 +422,8 @@ class Reline::LineEditor result + calculate_height_by_width(@prompt_width + calculate_width(line)) } end - move_cursor_down(@first_line_started_from) + @started_from = calculate_height_by_width(@prompt_width + @cursor) - 1 + move_cursor_down(@first_line_started_from + @started_from) Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last) @rerender_all = false rendered = true