diff options
author | aycabta <aycabta@gmail.com> | 2021-10-03 18:25:26 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-10-03 21:51:02 +0900 |
commit | 64e96d6b4100cd7ef53ed1a7d14c1298ccb0eb23 (patch) | |
tree | 2f0d98fdab0671375fa980f118b4299481d8a230 /lib | |
parent | 208b7b81990edea6e220a4e2e4e0995c4ec0aad1 (diff) | |
download | ruby-64e96d6b4100cd7ef53ed1a7d14c1298ccb0eb23.tar.gz |
[ruby/reline] Re-calc the scroll pos when the content in dialog is shortened
https://github.com/ruby/reline/commit/12ea63e6e0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 1722abc939..d4a3e06a3d 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -673,6 +673,9 @@ class Reline::LineEditor end dialog.contents = dialog.contents[dialog.scroll_top, height] end + if dialog.contents and dialog.scroll_top >= dialog.contents.size + dialog.scroll_top = dialog.contents.size - height + end if dialog_render_info.scrollbar and dialog_render_info.contents.size > height bar_max_height = height * 2 moving_distance = (dialog_render_info.contents.size - height) * 2 |