mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "5b4b055c6cbb9532f42901310db5ba26a93a1b3b" and "ade14a62388a2ab1914228f969add1987df39dc8" have entirely different histories.
5b4b055c6c
...
ade14a6238
|
@ -60,7 +60,7 @@ Available sections: ]] .. table.concat(modules, ', ')
|
||||||
return lunacolors.underline(lunacolors.blue(string.gsub(fname, '.md', '')))
|
return lunacolors.underline(lunacolors.blue(string.gsub(fname, '.md', '')))
|
||||||
end)
|
end)
|
||||||
if #moddocs ~= 0 then
|
if #moddocs ~= 0 then
|
||||||
funcdocs = funcdocs .. '\nSubdocs: ' .. table.concat(subdocs, ', ')
|
funcdocs = funcdocs .. '\nSubdocs: ' .. table.concat(subdocs, ', ') .. '\nLMAO'
|
||||||
end
|
end
|
||||||
|
|
||||||
local valsStr = funcdocs:match '%-%-%-\n([^%-%-%-]+)\n'
|
local valsStr = funcdocs:match '%-%-%-\n([^%-%-%-]+)\n'
|
||||||
|
@ -89,7 +89,7 @@ Available sections: ]] .. table.concat(modules, ', ')
|
||||||
|
|
||||||
local gh = Greenhouse(sinks.out)
|
local gh = Greenhouse(sinks.out)
|
||||||
local backtickOccurence = 0
|
local backtickOccurence = 0
|
||||||
local page = Page(nil, lunacolors.format(doc:gsub('`', function()
|
local page = Page(lunacolors.format(doc:gsub('`', function()
|
||||||
backtickOccurence = backtickOccurence + 1
|
backtickOccurence = backtickOccurence + 1
|
||||||
if backtickOccurence % 2 == 0 then
|
if backtickOccurence % 2 == 0 then
|
||||||
return '{reset}'
|
return '{reset}'
|
||||||
|
|
|
@ -44,21 +44,6 @@ function Greenhouse:updateCurrentPage(text)
|
||||||
page:setText(text)
|
page:setText(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sub(str, limit)
|
|
||||||
local overhead = 0
|
|
||||||
local function addOverhead(s)
|
|
||||||
overhead = overhead + string.len(s)
|
|
||||||
end
|
|
||||||
|
|
||||||
local s = str:gsub('\x1b%[%d+;%d+;%d+;%d+;%d+%w', addOverhead)
|
|
||||||
:gsub('\x1b%[%d+;%d+;%d+;%d+%w', addOverhead)
|
|
||||||
:gsub('\x1b%[%d+;%d+;%d+%w',addOverhead)
|
|
||||||
:gsub('\x1b%[%d+;%d+%w', addOverhead)
|
|
||||||
:gsub('\x1b%[%d+%w', addOverhead)
|
|
||||||
|
|
||||||
return s:sub(0, limit + overhead)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Greenhouse:draw()
|
function Greenhouse:draw()
|
||||||
local workingPage = self.pages[self.curPage]
|
local workingPage = self.pages[self.curPage]
|
||||||
local offset = self.offset
|
local offset = self.offset
|
||||||
|
@ -71,9 +56,10 @@ function Greenhouse:draw()
|
||||||
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
|
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
|
||||||
self.sink:write(ansikit.getCSI(2, 'J'))
|
self.sink:write(ansikit.getCSI(2, 'J'))
|
||||||
|
|
||||||
for i = offset, offset + (self.region.height - 1) do
|
-- the -2 negate is for the command and status line
|
||||||
|
for i = offset, offset + (self.region.height - self.start) do
|
||||||
if i > #lines then break end
|
if i > #lines then break end
|
||||||
self.sink:writeln('\r' .. sub(lines[i]:gsub('\t', ' '), self.region.width - 2))
|
self.sink:writeln('\r' .. lines[i]:gsub('\t', ' '):sub(0, self.region.width - 2))
|
||||||
end
|
end
|
||||||
self.sink:write '\r'
|
self.sink:write '\r'
|
||||||
self:render()
|
self:render()
|
||||||
|
@ -96,7 +82,7 @@ function Greenhouse:scroll(direction)
|
||||||
|
|
||||||
local oldOffset = self.offset
|
local oldOffset = self.offset
|
||||||
if direction == 'down' then
|
if direction == 'down' then
|
||||||
self.offset = math.min(self.offset + 1, math.max(1, #lines - self.region.height + 1))
|
self.offset = math.min(self.offset + 1, #lines)
|
||||||
elseif direction == 'up' then
|
elseif direction == 'up' then
|
||||||
self.offset = math.max(self.offset - 1, 1)
|
self.offset = math.max(self.offset - 1, 1)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue