Make linemode spacing consistent between solo and children_add linemodes

This commit is contained in:
SolitudeSF 2024-08-31 17:59:02 +03:00
parent 907ac09e34
commit ea674d61d9
No known key found for this signature in database
GPG key ID: 789B06817C385387

View file

@ -14,14 +14,10 @@ function Linemode:solo()
end
if not self[mode] then
return ui.Line(" " .. mode .. " ")
return ui.Line(mode)
end
return ui.Line {
ui.Span(" "),
self[mode](self),
ui.Span(" "),
}
return ui.Line { self[mode](self) }
end
function Linemode:size()
@ -63,6 +59,9 @@ function Linemode:render()
local lines = {}
for _, c in ipairs(self._children) do
lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self)
if lines[#lines] and lines[#lines]:width() > 0 then
lines[#lines + 1] = ui.Line { ui.Span(" ") }
end
end
return ui.Line(lines)
end