Skip to content

Commit

Permalink
Fix dialog rendering at the bottom edge
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Aug 30, 2021
1 parent 6e0ea33 commit 860be91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 860be91

Please sign in to comment.