Skip to content

Commit f197139

Browse files
committed
Handle past logs correctly when the code is higher than the screen
1 parent 8cd9132 commit f197139

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/reline/line_editor.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,13 @@ def just_move_cursor
600600
new_first_line_started_from = calculate_height_by_lines(new_buffer[0..(@line_index - 1)], prompt_list || prompt)
601601
end
602602
new_started_from = calculate_height_by_width(prompt_width + @cursor) - 1
603-
if back > old_highest_in_all
603+
calculate_scroll_partial_screen(back, new_first_line_started_from + new_started_from)
604+
if @scroll_partial_screen
605+
move_cursor_up(@first_line_started_from + @started_from)
606+
scroll_down(@screen_height - 1)
607+
move_cursor_up(@screen_height)
608+
Reline::IOGate.move_cursor_column(0)
609+
elsif back > old_highest_in_all
604610
scroll_down(back - 1)
605611
move_cursor_up(back - 1)
606612
elsif back < old_highest_in_all
@@ -612,7 +618,6 @@ def just_move_cursor
612618
end
613619
move_cursor_up(old_highest_in_all - 1)
614620
end
615-
calculate_scroll_partial_screen(back, new_first_line_started_from + new_started_from)
616621
render_whole_lines(new_buffer, prompt_list || prompt, prompt_width)
617622
if @prompt_proc
618623
prompt = prompt_list[@line_index]

0 commit comments

Comments
 (0)