From efe5f1a6aedef11f9c2152fd0f90c90552801906 Mon Sep 17 00:00:00 2001 From: lopy <70210066+lopi-py@users.noreply.github.com> Date: Fri, 11 Oct 2024 00:26:41 -0500 Subject: [PATCH] fix: don't initialize first_fill with 1 --- lua/blink/cmp/windows/lib/render.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/blink/cmp/windows/lib/render.lua b/lua/blink/cmp/windows/lib/render.lua index ee19a3f0..958d56ff 100644 --- a/lua/blink/cmp/windows/lib/render.lua +++ b/lua/blink/cmp/windows/lib/render.lua @@ -108,13 +108,13 @@ end --- @return number[] function renderer.get_max_lengths(components_list, min_width) local lengths = {} - local first_fill = 1 + local first_fill 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 + if component.fill and not first_fill then first_fill = i end end end @@ -122,6 +122,7 @@ function renderer.get_max_lengths(components_list, min_width) min_width = min_width - length end + first_fill = first_fill or 1 if min_width > 0 then lengths[first_fill] = lengths[first_fill] + min_width end return lengths