summaryrefslogtreecommitdiff
path: root/lib/reline
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-08-31 01:13:21 +0900
committergit <svn-admin@ruby-lang.org>2021-08-31 05:26:28 +0900
commit0c09418fff2900d8e878f3ad92469a060d159667 (patch)
treed968f4d5529c653e15b5b0fcfa33b5221722e8a3 /lib/reline
parent203f46ceef555b6c9f0dd53bbf53e0d08e8b9766 (diff)
downloadruby-0c09418fff2900d8e878f3ad92469a060d159667.tar.gz
[ruby/reline] Fix dialog rendering at the bottom edge
https://github.com/ruby/reline/commit/860be91bd7
Diffstat (limited to 'lib/reline')
-rw-r--r--lib/reline/line_editor.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index c6d0c9f698..f93731d722 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -592,14 +592,14 @@ class Reline::LineEditor
if diff > 0
dialog.column -= diff
end
- if (lower_space + @rest_height) >= DIALOG_HEIGHT
+ if (lower_space + @rest_height - pos.y) >= DIALOG_HEIGHT
dialog.vertical_offset = pos.y + 1
elsif upper_space >= DIALOG_HEIGHT
dialog.vertical_offset = pos.y + -(DIALOG_HEIGHT + 1)
else
- if (lower_space + @rest_height) < DIALOG_HEIGHT
- scroll_down(DIALOG_HEIGHT)
- move_cursor_up(DIALOG_HEIGHT)
+ if (lower_space + @rest_height - pos.y) < DIALOG_HEIGHT
+ scroll_down(DIALOG_HEIGHT + pos.y)
+ move_cursor_up(DIALOG_HEIGHT + pos.y)
end
dialog.vertical_offset = pos.y + 1
end