diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline.rb | 2 | ||||
-rw-r--r-- | lib/reline/line_editor.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index a128d7347d..fd70ffc9d0 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -260,7 +260,7 @@ module Reline pos: cursor_pos_to_render, contents: result, scrollbar: true, - height: 15, + height: [15, preferred_dialog_height].min, bg_color: 46, pointer_bg_color: 45, fg_color: 37, diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index b6304bc040..2e84ca4d0c 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -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 |