[ruby/reline] Use appropriate dialog height and reduce screen pushup

problem
(https://github.com/ruby/reline/pull/542)

* Provide preferred_dialog_height for dialog positioning

* Fix rendering test
This commit is contained in:
tomoya ishida 2023-05-27 23:48:45 +09:00 committed by git
parent bf1bc5362e
commit 5d137a7f77
3 changed files with 34 additions and 18 deletions

View file

@ -562,6 +562,16 @@ class Reline::LineEditor
@line_editor.instance_variable_get(:@screen_size).last
end
def screen_height
@line_editor.instance_variable_get(:@screen_size).first
end
def preferred_dialog_height
rest_height = @line_editor.instance_variable_get(:@rest_height)
scroll_partial_screen = @line_editor.instance_variable_get(:@scroll_partial_screen) || 0
[cursor_pos.y - scroll_partial_screen, rest_height, (screen_height + 6) / 5].max
end
def completion_journey_data
@line_editor.instance_variable_get(:@completion_journey_data)
end