From a7bc847ff624de1e8e48fa00e1c922ba1caff8f0 Mon Sep 17 00:00:00 2001 From: lopy <70210066+lopi-py@users.noreply.github.com> Date: Fri, 11 Oct 2024 00:07:02 -0500 Subject: [PATCH] fix: respect autocomplete min_width --- lua/blink/cmp/windows/lib/render.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/blink/cmp/windows/lib/render.lua b/lua/blink/cmp/windows/lib/render.lua index 05f1be12..ee19a3f0 100644 --- a/lua/blink/cmp/windows/lib/render.lua +++ b/lua/blink/cmp/windows/lib/render.lua @@ -108,17 +108,22 @@ end --- @return number[] function renderer.get_max_lengths(components_list, min_width) local lengths = {} + local first_fill = 1 + for _, components in ipairs(components_list) do for i, component in ipairs(components) do local length = renderer.get_length(component) if not lengths[i] or lengths[i] < length then lengths[i] = length end + if component.fill and first_fill == 1 then first_fill = i end end end - for i, length in ipairs(lengths) do - if length < min_width then lengths[i] = min_width end + for _, length in ipairs(lengths) do + min_width = min_width - length end + if min_width > 0 then lengths[first_fill] = lengths[first_fill] + min_width end + return lengths end