Skip to content

Commit 410a736

Browse files
committed
fix(ui): trailing space in button row. Fixes #884
1 parent 56b1f77 commit 410a736

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

lua/lazy/view/render.lua

+23-18
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,35 @@ end
113113

114114
function M:title()
115115
self:nl():nl()
116-
for _, mode in ipairs(ViewConfig.get_commands()) do
117-
if mode.button then
118-
local title = " " .. mode.name:sub(1, 1):upper() .. mode.name:sub(2) .. " (" .. mode.key .. ") "
119-
if mode.name == "home" then
120-
if self.view.state.mode == "home" then
121-
title = " lazy.nvim " .. Config.options.ui.icons.lazy
122-
else
123-
title = " lazy.nvim (H) "
124-
end
116+
local modes = vim.tbl_filter(function(c)
117+
return c.button
118+
end, ViewConfig.get_commands())
119+
120+
for c, mode in ipairs(modes) do
121+
local title = " " .. mode.name:sub(1, 1):upper() .. mode.name:sub(2) .. " (" .. mode.key .. ") "
122+
if mode.name == "home" then
123+
if self.view.state.mode == "home" then
124+
title = " lazy.nvim " .. Config.options.ui.icons.lazy
125+
else
126+
title = " lazy.nvim (H) "
125127
end
128+
end
126129

127-
if self.view.state.mode == mode.name then
128-
if mode.name == "home" then
129-
self:append(title, "LazyH1", { wrap = true })
130-
else
131-
self:append(title, "LazyButtonActive", { wrap = true })
132-
self:highlight({ ["%(.%)"] = "LazySpecial" })
133-
end
130+
if self.view.state.mode == mode.name then
131+
if mode.name == "home" then
132+
self:append(title, "LazyH1", { wrap = true })
134133
else
135-
self:append(title, "LazyButton", { wrap = true })
134+
self:append(title, "LazyButtonActive", { wrap = true })
136135
self:highlight({ ["%(.%)"] = "LazySpecial" })
137136
end
138-
self:append(" ")
137+
else
138+
self:append(title, "LazyButton", { wrap = true })
139+
self:highlight({ ["%(.%)"] = "LazySpecial" })
139140
end
141+
if c == #modes then
142+
break
143+
end
144+
self:append(" ")
140145
end
141146
self:nl()
142147
if self.progress.done < self.progress.total then

0 commit comments

Comments
 (0)