From 860be91bd7ae272750166459fd1a4154e916963d Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 31 Aug 2021 01:13:21 +0900 Subject: [PATCH] Fix dialog rendering at the bottom edge --- lib/reline/line_editor.rb | 8 ++++---- 1 file 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 @@ def add_dialog_proc(name, p, context = nil) 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