mirror of https://github.com/Hilbis/Hilbish
fix(nature/greenhouse): reset line offset when switching pages
parent
179bec7ae5
commit
ec0692edeb
|
@ -68,14 +68,21 @@ function Greenhouse:update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Greenhouse:next()
|
function Greenhouse:next()
|
||||||
|
local oldCurrent = self.curPage
|
||||||
self.curPage = math.min(self.curPage + 1, #self.pages)
|
self.curPage = math.min(self.curPage + 1, #self.pages)
|
||||||
self.sink:write(ansikit.getCSI(2, 'J'))
|
if self.curPage ~= oldCurrent then
|
||||||
self:draw()
|
self.offset = 1
|
||||||
|
self:draw()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Greenhouse:previous()
|
function Greenhouse:previous()
|
||||||
|
local oldCurrent = self.curPage
|
||||||
self.curPage = math.max(self.curPage - 1, 1)
|
self.curPage = math.max(self.curPage - 1, 1)
|
||||||
self:draw()
|
if self.curPage ~= oldCurrent then
|
||||||
|
self.offset = 1
|
||||||
|
self:draw()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return Greenhouse
|
return Greenhouse
|
||||||
|
|
Loading…
Reference in New Issue