mirror of https://github.com/Hilbis/Hilbish
fix(nature/greenhouse): draw pager body properly
parent
e454ab0d70
commit
45eb3d17e3
|
@ -14,7 +14,7 @@ function Greenhouse:new(sink)
|
||||||
local size = terminal.size()
|
local size = terminal.size()
|
||||||
self.region = size
|
self.region = size
|
||||||
self.start = 1
|
self.start = 1
|
||||||
self.offset = 0
|
self.offset = 1
|
||||||
self.sink = sink
|
self.sink = sink
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
@ -27,11 +27,9 @@ end
|
||||||
function Greenhouse:draw()
|
function Greenhouse:draw()
|
||||||
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
|
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
|
||||||
|
|
||||||
for i = 1, #self.lines do
|
for i = self.offset, self.offset + (self.region.height - self.start) - 1 do
|
||||||
if i > self.region.height - 1 then break end
|
self.sink:write(ansikit.getCSI(2, 'K'))
|
||||||
if not self.lines[i + self.offset] then break end
|
self.sink:writeln(self.lines[i]:gsub('\t', ' '):sub(0, self.region.width - 2))
|
||||||
|
|
||||||
self.sink:writeln(self.lines[i + self.offset]:gsub('\t', ' '):sub(0, self.region.width - 2))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue