fix(picker.list): correct offset calculation for large scrolloff. Closes #1208

This commit is contained in:
Folke Lemaitre 2025-02-17 14:24:49 +01:00
parent 4589e25758
commit f4ca368672
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -226,7 +226,7 @@ function M:close()
end
function M:scrolloff()
local scrolloff = math.min(self.state.scrolloff, math.floor(self:height() / 2))
local scrolloff = math.min(self.state.scrolloff, math.floor((self:height() - 1) / 2))
local offset = math.min(self.cursor, self:count() - self.cursor)
return offset > scrolloff and scrolloff or 0
end