Skip to content

fix: don't initialize first_fill with 1 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lua/blink/cmp/windows/lib/render.lua
Original file line number Diff line number Diff line change
@@ -108,20 +108,21 @@ 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

for _, length in ipairs(lengths) do
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