mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
[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:
parent
bf1bc5362e
commit
5d137a7f77
3 changed files with 34 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue