summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-01-31 23:44:13 +0900
committeraycabta <aycabta@gmail.com>2021-02-07 05:11:27 +0900
commitb371ca3f4f304fdc219fe638ff3614b02780c2d3 (patch)
tree145611a23ca99dc33be75b318cd49476cc8d7f58
parentbd0f8b36fd31951a23f918074a2ba2c95c55a28a (diff)
[ruby/reline] Handle past logs correctly when the code is higher than the screen
https://github.com/ruby/reline/commit/f197139b4a
-rw-r--r--lib/reline/line_editor.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 47ffe4dfbd..16c41b5c5d 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -600,7 +600,13 @@ class Reline::LineEditor
new_first_line_started_from = calculate_height_by_lines(new_buffer[0..(@line_index - 1)], prompt_list || prompt)
end
new_started_from = calculate_height_by_width(prompt_width + @cursor) - 1
- if back > old_highest_in_all
+ calculate_scroll_partial_screen(back, new_first_line_started_from + new_started_from)
+ if @scroll_partial_screen
+ move_cursor_up(@first_line_started_from + @started_from)
+ scroll_down(@screen_height - 1)
+ move_cursor_up(@screen_height)
+ Reline::IOGate.move_cursor_column(0)
+ elsif back > old_highest_in_all
scroll_down(back - 1)
move_cursor_up(back - 1)
elsif back < old_highest_in_all
@@ -612,7 +618,6 @@ class Reline::LineEditor
end
move_cursor_up(old_highest_in_all - 1)
end
- calculate_scroll_partial_screen(back, new_first_line_started_from + new_started_from)
render_whole_lines(new_buffer, prompt_list || prompt, prompt_width)
if @prompt_proc
prompt = prompt_list[@line_index]