fix(dashboard): minimum one pane even when it doesn't fit the screen. Fixes #104

This commit is contained in:
Folke Lemaitre 2024-11-19 00:20:34 +01:00
parent 68fcc25802
commit be8feef4ab
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -541,7 +541,8 @@ end
-- Layout in panes
function D:layout()
self:trace("layout")
local max_panes = math.floor((self._size.width + self.opts.pane_gap) / (self.opts.width + self.opts.pane_gap))
local max_panes =
math.max(1, math.floor((self._size.width + self.opts.pane_gap) / (self.opts.width + self.opts.pane_gap)))
self.panes = {} ---@type snacks.dashboard.Item[][]
for _, item in ipairs(self.items) do
local pane = item.pane or 1