diff options
author | aycabta <aycabta@gmail.com> | 2021-01-31 23:44:13 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-02-07 05:11:27 +0900 |
commit | b371ca3f4f304fdc219fe638ff3614b02780c2d3 (patch) | |
tree | 145611a23ca99dc33be75b318cd49476cc8d7f58 /lib/reline/line_editor.rb | |
parent | bd0f8b36fd31951a23f918074a2ba2c95c55a28a (diff) | |
download | ruby-b371ca3f4f304fdc219fe638ff3614b02780c2d3.tar.gz |
[ruby/reline] Handle past logs correctly when the code is higher than the screen
https://github.com/ruby/reline/commit/f197139b4a
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 9 |
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] |