ruby-changes:67565
From: aycabta <ko1@a...>
Date: Fri, 3 Sep 2021 03:32:18 +0900 (JST)
Subject: [ruby-changes:67565] 93080111cd (master): [ruby/reline] Fix autocomplete dialog width
https://git.ruby-lang.org/ruby.git/commit/?id=93080111cd From 93080111cdb96b90f66ec6913e242eef45d7b49e Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 3 Sep 2021 00:03:14 +0900 Subject: [ruby/reline] Fix autocomplete dialog width https://github.com/ruby/reline/commit/9868432687 --- lib/reline/line_editor.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 56d874b..1aa0360 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -605,7 +605,11 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L605 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 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/