Skip to content

Commit 526f786

Browse files
authored
fix: don't initialize first_fill with 1 (#87)
1 parent c15aefe commit 526f786

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/blink/cmp/windows/lib/render.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,21 @@ end
108108
--- @return number[]
109109
function renderer.get_max_lengths(components_list, min_width)
110110
local lengths = {}
111-
local first_fill = 1
111+
local first_fill
112112

113113
for _, components in ipairs(components_list) do
114114
for i, component in ipairs(components) do
115115
local length = renderer.get_length(component)
116116
if not lengths[i] or lengths[i] < length then lengths[i] = length end
117-
if component.fill and first_fill == 1 then first_fill = i end
117+
if component.fill and not first_fill then first_fill = i end
118118
end
119119
end
120120

121121
for _, length in ipairs(lengths) do
122122
min_width = min_width - length
123123
end
124124

125+
first_fill = first_fill or 1
125126
if min_width > 0 then lengths[first_fill] = lengths[first_fill] + min_width end
126127

127128
return lengths

0 commit comments

Comments
 (0)