fix(nature/greenhouse): reset line offset when switching pages

pager
sammyette 2023-02-19 17:05:25 -04:00
parent 179bec7ae5
commit ec0692edeb
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 10 additions and 3 deletions

View File

@ -68,14 +68,21 @@ function Greenhouse:update()
end
function Greenhouse:next()
local oldCurrent = self.curPage
self.curPage = math.min(self.curPage + 1, #self.pages)
self.sink:write(ansikit.getCSI(2, 'J'))
self:draw()
if self.curPage ~= oldCurrent then
self.offset = 1
self:draw()
end
end
function Greenhouse:previous()
local oldCurrent = self.curPage
self.curPage = math.max(self.curPage - 1, 1)
self:draw()
if self.curPage ~= oldCurrent then
self.offset = 1
self:draw()
end
end
return Greenhouse