File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -690,15 +690,26 @@ local function print_to_terminal()
690690 end
691691
692692 if not dim_completions then
693+ local term_size = mp .get_property_native (" term-size" , { w = 80 , h = 24 })
694+ local max_width = term_size .w * (term_size .h - 2 - select (2 ,
695+ (prompt .. mp .get_property (" term-status-msg" )):gsub (" \\ n" , " " )))
696+ local completions = " "
697+
693698 for i , completion in ipairs (completion_buffer ) do
694699 if should_highlight_completion (i ) then
695- log = log .. terminal_styles .selected_completion ..
696- completion .. " \027 [0m"
700+ completions = completions .. terminal_styles .selected_completion ..
701+ completion .. " \027 [0m"
697702 else
698- log = log .. completion
703+ completions = completions .. completion
704+ end
705+ completions = completions .. (i < # completion_buffer and " \t " or " " )
706+
707+ if utils .terminal_display_width (completions ) > max_width then
708+ break
699709 end
700- log = log .. (i < # completion_buffer and " \t " or " \n " )
701710 end
711+
712+ log = log .. completions .. " \n "
702713 end
703714 end
704715
You can’t perform that action at this time.
0 commit comments