diff options
author | aycabta <aycabta@gmail.com> | 2021-09-03 00:03:14 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-09-03 03:32:07 +0900 |
commit | 93080111cdb96b90f66ec6913e242eef45d7b49e (patch) | |
tree | d8fdd88b902213746952b23f6eb37f48ee3bb509 /lib | |
parent | 8f56629bb292911d276aee31de9bd28e4ee7d4f9 (diff) |
[ruby/reline] Fix autocomplete dialog width
https://github.com/ruby/reline/commit/9868432687
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 56d874bc08..1aa0360393 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -605,7 +605,11 @@ class Reline::LineEditor return end old_dialog = dialog.clone - dialog.width = dialog_render_info.width if dialog_render_info.width + if dialog_render_info.width + dialog.width = dialog_render_info.width + else + dialog.width = dialog_render_info.contents.map { |l| calculate_width(l, true) }.max + end height = dialog_render_info.height || DIALOG_HEIGHT pointer = dialog_render_info.pointer dialog.contents = dialog_render_info.contents |