Skip to content

Commit 9868432

Browse files
committed
Fix autocomplete dialog width
1 parent 175d5ad commit 9868432

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/reline/line_editor.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,11 @@ def add_dialog_proc(name, p, context = nil)
605605
return
606606
end
607607
old_dialog = dialog.clone
608-
dialog.width = dialog_render_info.width if dialog_render_info.width
608+
if dialog_render_info.width
609+
dialog.width = dialog_render_info.width
610+
else
611+
dialog.width = dialog_render_info.contents.map { |l| calculate_width(l, true) }.max
612+
end
609613
height = dialog_render_info.height || DIALOG_HEIGHT
610614
pointer = dialog_render_info.pointer
611615
dialog.contents = dialog_render_info.contents

0 commit comments

Comments
 (0)