feat(commands/doc): display separator, add space in code block

pull/260/head
sammyette 2023-12-18 10:16:57 -04:00
parent 42d86f2d37
commit 2cac53d6e7
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
18 changed files with 161 additions and 75 deletions

2
api.go
View File

@ -403,7 +403,7 @@ hilbish.appendPath '~/go/bin'
-- Will add ~/go/bin to the command path.
-- Or do multiple:
hilbush.appendPath {
hilbish.appendPath {
'~/go/bin',
'~/.local/bin'
}

View File

@ -533,7 +533,7 @@ func main() {
if dps.IsMember {
continue
}
f.WriteString(fmt.Sprintf("<hr><div id='%s'>", dps.FuncName))
f.WriteString(fmt.Sprintf("<hr>\n<div id='%s'>", dps.FuncName))
htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(modname + "." + dps.FuncSig, "<", `\<`, -1), func(typ string) string {
typName := typ[1:]
typLookup := typeTable[strings.ToLower(typName)]

View File

@ -41,7 +41,8 @@ this function will set the user prompt.
|<a href="#release">release(name, catcher)</a>|Removes the `catcher` for the event with `name`.|
|<a href="#throw">throw(name, ...args)</a>|Throws a hook with `name` with the provided `args`.|
<hr><div id='catch'>
<hr>
<div id='catch'>
<h4 class='heading'>
bait.catch(name, cb)
<a href="#catch" class='heading-link'>
@ -67,7 +68,8 @@ end)
```
</div>
<hr><div id='catchOnce'>
<hr>
<div id='catchOnce'>
<h4 class='heading'>
bait.catchOnce(name, cb)
<a href="#catchOnce" class='heading-link'>
@ -85,7 +87,8 @@ The function that will be called when the event is thrown.
</div>
<hr><div id='hooks'>
<hr>
<div id='hooks'>
<h4 class='heading'>
bait.hooks(name) -> table
<a href="#hooks" class='heading-link'>
@ -100,7 +103,8 @@ The name of the function
</div>
<hr><div id='release'>
<hr>
<div id='release'>
<h4 class='heading'>
bait.release(name, catcher)
<a href="#release" class='heading-link'>
@ -132,7 +136,8 @@ bait.release('event', hookCallback)
```
</div>
<hr><div id='throw'>
<hr>
<div id='throw'>
<h4 class='heading'>
bait.throw(name, ...args)
<a href="#throw" class='heading-link'>

View File

@ -42,7 +42,8 @@ This sink is for writing errors, as the name would suggest.
|<a href="#deregister">deregister(name)</a>|Removes the named command. Note that this will only remove Commander-registered commands.|
|<a href="#register">register(name, cb)</a>|Adds a new command with the given `name`. When Hilbish has to run a command with a name,|
<hr><div id='deregister'>
<hr>
<div id='deregister'>
<h4 class='heading'>
commander.deregister(name)
<a href="#deregister" class='heading-link'>
@ -57,7 +58,8 @@ Name of the command to remove.
</div>
<hr><div id='register'>
<hr>
<div id='register'>
<h4 class='heading'>
commander.register(name, cb)
<a href="#register" class='heading-link'>

View File

@ -31,7 +31,8 @@ library offers more functions and will work on any operating system Hilbish does
|----|----|
|pathSep|The operating system's path separator.|
<hr><div id='abs'>
<hr>
<div id='abs'>
<h4 class='heading'>
fs.abs(path) -> string
<a href="#abs" class='heading-link'>
@ -47,7 +48,8 @@ This can be used to resolve short paths like `..` to `/home/user`.
</div>
<hr><div id='basename'>
<hr>
<div id='basename'>
<h4 class='heading'>
fs.basename(path) -> string
<a href="#basename" class='heading-link'>
@ -63,7 +65,8 @@ Path to get the base name of.
</div>
<hr><div id='cd'>
<hr>
<div id='cd'>
<h4 class='heading'>
fs.cd(dir)
<a href="#cd" class='heading-link'>
@ -78,7 +81,8 @@ Path to change directory to.
</div>
<hr><div id='dir'>
<hr>
<div id='dir'>
<h4 class='heading'>
fs.dir(path) -> string
<a href="#dir" class='heading-link'>
@ -94,7 +98,8 @@ Path to get the directory for.
</div>
<hr><div id='glob'>
<hr>
<div id='glob'>
<h4 class='heading'>
fs.glob(pattern) -> matches (table)
<a href="#glob" class='heading-link'>
@ -125,7 +130,8 @@ print(matches)
```
</div>
<hr><div id='join'>
<hr>
<div id='join'>
<h4 class='heading'>
fs.join(...path) -> string
<a href="#join" class='heading-link'>
@ -148,7 +154,8 @@ print(fs.join(hilbish.userDir.config, 'hilbish'))
```
</div>
<hr><div id='mkdir'>
<hr>
<div id='mkdir'>
<h4 class='heading'>
fs.mkdir(name, recursive)
<a href="#mkdir" class='heading-link'>
@ -175,7 +182,8 @@ Whether to create parent directories for the provided name
```
</div>
<hr><div id='readdir'>
<hr>
<div id='readdir'>
<h4 class='heading'>
fs.readdir(path) -> table[string]
<a href="#readdir" class='heading-link'>
@ -190,7 +198,8 @@ Returns a list of all files and directories in the provided path.
</div>
<hr><div id='stat'>
<hr>
<div id='stat'>
<h4 class='heading'>
fs.stat(path) -> {}
<a href="#stat" class='heading-link'>

View File

@ -46,7 +46,8 @@ interfaces and functions which directly relate to shell functionality.
|vimMode|Current Vim input mode of Hilbish (will be nil if not in Vim input mode)|
|exitCode|Exit code of the last executed command|
<hr><div id='alias'>
<hr>
<div id='alias'>
<h4 class='heading'>
hilbish.alias(cmd, orig)
<a href="#alias" class='heading-link'>
@ -75,7 +76,8 @@ hilbish.alias('dircount', 'ls %1 | wc -l')
```
</div>
<hr><div id='appendPath'>
<hr>
<div id='appendPath'>
<h4 class='heading'>
hilbish.appendPath(dir)
<a href="#appendPath" class='heading-link'>
@ -96,14 +98,15 @@ hilbish.appendPath '~/go/bin'
-- Will add ~/go/bin to the command path.
-- Or do multiple:
hilbush.appendPath {
hilbish.appendPath {
'~/go/bin',
'~/.local/bin'
}
```
</div>
<hr><div id='complete'>
<hr>
<div id='complete'>
<h4 class='heading'>
hilbish.complete(scope, cb)
<a href="#complete" class='heading-link'>
@ -125,7 +128,8 @@ provides more details.
</div>
<hr><div id='cwd'>
<hr>
<div id='cwd'>
<h4 class='heading'>
hilbish.cwd() -> string
<a href="#cwd" class='heading-link'>
@ -138,7 +142,8 @@ Returns the current directory of the shell
This function has no parameters.
</div>
<hr><div id='exec'>
<hr>
<div id='exec'>
<h4 class='heading'>
hilbish.exec(cmd)
<a href="#exec" class='heading-link'>
@ -154,7 +159,8 @@ This can be used to do an in-place restart.
</div>
<hr><div id='goro'>
<hr>
<div id='goro'>
<h4 class='heading'>
hilbish.goro(fn)
<a href="#goro" class='heading-link'>
@ -171,7 +177,8 @@ This can be used to run any function in another thread.
</div>
<hr><div id='highlighter'>
<hr>
<div id='highlighter'>
<h4 class='heading'>
hilbish.highlighter(line)
<a href="#highlighter" class='heading-link'>
@ -198,7 +205,8 @@ end
```
</div>
<hr><div id='hinter'>
<hr>
<div id='hinter'>
<h4 class='heading'>
hilbish.hinter(line, pos)
<a href="#hinter" class='heading-link'>
@ -229,7 +237,8 @@ end
```
</div>
<hr><div id='inputMode'>
<hr>
<div id='inputMode'>
<h4 class='heading'>
hilbish.inputMode(mode)
<a href="#inputMode" class='heading-link'>
@ -246,7 +255,8 @@ Vim-like with modes and Vim keybinds.
</div>
<hr><div id='interval'>
<hr>
<div id='interval'>
<h4 class='heading'>
hilbish.interval(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#interval" class='heading-link'>
@ -265,7 +275,8 @@ This creates a timer that starts immediately.
</div>
<hr><div id='multiprompt'>
<hr>
<div id='multiprompt'>
<h4 class='heading'>
hilbish.multiprompt(str)
<a href="#multiprompt" class='heading-link'>
@ -301,7 +312,8 @@ hilbish.multiprompt '-->'
```
</div>
<hr><div id='prependPath'>
<hr>
<div id='prependPath'>
<h4 class='heading'>
hilbish.prependPath(dir)
<a href="#prependPath" class='heading-link'>
@ -316,7 +328,8 @@ Prepends `dir` to $PATH.
</div>
<hr><div id='prompt'>
<hr>
<div id='prompt'>
<h4 class='heading'>
hilbish.prompt(str, typ)
<a href="#prompt" class='heading-link'>
@ -348,7 +361,8 @@ hilbish.prompt '%u@%h :%d $'
```
</div>
<hr><div id='read'>
<hr>
<div id='read'>
<h4 class='heading'>
hilbish.read(prompt) -> input (string)
<a href="#read" class='heading-link'>
@ -365,7 +379,8 @@ Returns `input`, will be nil if ctrl + d is pressed, or an error occurs (which s
</div>
<hr><div id='run'>
<hr>
<div id='run'>
<h4 class='heading'>
hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)
<a href="#run" class='heading-link'>
@ -383,7 +398,8 @@ If this is true, the function will return the standard output and error of the c
</div>
<hr><div id='runnerMode'>
<hr>
<div id='runnerMode'>
<h4 class='heading'>
hilbish.runnerMode(mode)
<a href="#runnerMode" class='heading-link'>
@ -402,7 +418,8 @@ will call it to execute user input instead.
</div>
<hr><div id='timeout'>
<hr>
<div id='timeout'>
<h4 class='heading'>
hilbish.timeout(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#timeout" class='heading-link'>
@ -421,7 +438,8 @@ This creates a Timer that starts immediately.
</div>
<hr><div id='which'>
<hr>
<div id='which'>
<h4 class='heading'>
hilbish.which(name) -> string
<a href="#which" class='heading-link'>

View File

@ -18,7 +18,8 @@ The alias interface deals with all command aliases in Hilbish.
|<a href="#aliases.list">list() -> table[string, string]</a>|Get a table of all aliases, with string keys as the alias and the value as the command.|
|<a href="#aliases.resolve">resolve(alias) -> string?</a>|Resolves an alias to its original command. Will thrown an error if the alias doesn't exist.|
<hr><div id='aliases.add'>
<hr>
<div id='aliases.add'>
<h4 class='heading'>
hilbish.aliases.add(alias, cmd)
<a href="#aliases.add" class='heading-link'>
@ -31,7 +32,8 @@ This is an alias (ha) for the [hilbish.alias](../#alias) function.
This function has no parameters.
</div>
<hr><div id='aliases.delete'>
<hr>
<div id='aliases.delete'>
<h4 class='heading'>
hilbish.aliases.delete(name)
<a href="#aliases.delete" class='heading-link'>
@ -46,7 +48,8 @@ Removes an alias.
</div>
<hr><div id='aliases.list'>
<hr>
<div id='aliases.list'>
<h4 class='heading'>
hilbish.aliases.list() -> table[string, string]
<a href="#aliases.list" class='heading-link'>
@ -68,7 +71,8 @@ local aliases = hilbish.aliases.list()
```
</div>
<hr><div id='aliases.resolve'>
<hr>
<div id='aliases.resolve'>
<h4 class='heading'>
hilbish.aliases.resolve(alias) -> string?
<a href="#aliases.resolve" class='heading-link'>

View File

@ -18,7 +18,8 @@ The completions interface deals with tab completions.
|<a href="#completion.files">files(query, ctx, fields) -> entries (table), prefix (string)</a>|Returns file matches based on the provided parameters.|
|<a href="#completion.handler">handler(line, pos)</a>|This function contains the general completion handler for Hilbish. This function handles|
<hr><div id='completion.bins'>
<hr>
<div id='completion.bins'>
<h4 class='heading'>
hilbish.completion.bins(query, ctx, fields) -> entries (table), prefix (string)
<a href="#completion.bins" class='heading-link'>
@ -60,7 +61,8 @@ end)
```
</div>
<hr><div id='completion.call'>
<hr>
<div id='completion.call'>
<h4 class='heading'>
hilbish.completion.call(name, query, ctx, fields) -> completionGroups (table), prefix (string)
<a href="#completion.call" class='heading-link'>
@ -86,7 +88,8 @@ You can check the Completions doc or `doc completions` for info on the `completi
</div>
<hr><div id='completion.files'>
<hr>
<div id='completion.files'>
<h4 class='heading'>
hilbish.completion.files(query, ctx, fields) -> entries (table), prefix (string)
<a href="#completion.files" class='heading-link'>
@ -108,7 +111,8 @@ This function is meant to be used as a helper in a command completion handler.
</div>
<hr><div id='completion.handler'>
<hr>
<div id='completion.handler'>
<h4 class='heading'>
hilbish.completion.handler(line, pos)
<a href="#completion.handler" class='heading-link'>

View File

@ -20,7 +20,8 @@ directly interact with the line editor in use.
|<a href="#editor.getChar">getChar() -> string</a>|Reads a keystroke from the user. This is in a format of something like Ctrl-L.|
|<a href="#editor.setVimRegister">setVimRegister(register, text)</a>|Sets the vim register at `register` to hold the passed text.|
<hr><div id='editor.getLine'>
<hr>
<div id='editor.getLine'>
<h4 class='heading'>
hilbish.editor.getLine() -> string
<a href="#editor.getLine" class='heading-link'>
@ -33,7 +34,8 @@ Returns the current input line.
This function has no parameters.
</div>
<hr><div id='editor.getVimRegister'>
<hr>
<div id='editor.getVimRegister'>
<h4 class='heading'>
hilbish.editor.getVimRegister(register) -> string
<a href="#editor.getVimRegister" class='heading-link'>
@ -48,7 +50,8 @@ Returns the text that is at the register.
</div>
<hr><div id='editor.insert'>
<hr>
<div id='editor.insert'>
<h4 class='heading'>
hilbish.editor.insert(text)
<a href="#editor.insert" class='heading-link'>
@ -63,7 +66,8 @@ Inserts text into the Hilbish command line.
</div>
<hr><div id='editor.getChar'>
<hr>
<div id='editor.getChar'>
<h4 class='heading'>
hilbish.editor.getChar() -> string
<a href="#editor.getChar" class='heading-link'>
@ -76,7 +80,8 @@ Reads a keystroke from the user. This is in a format of something like Ctrl-L.
This function has no parameters.
</div>
<hr><div id='editor.setVimRegister'>
<hr>
<div id='editor.setVimRegister'>
<h4 class='heading'>
hilbish.editor.setVimRegister(register, text)
<a href="#editor.setVimRegister" class='heading-link'>

View File

@ -21,7 +21,8 @@ method of saving history.
|<a href="#history.get">get(index)</a>|Retrieves a command from the history based on the `index`.|
|<a href="#history.size">size() -> number</a>|Returns the amount of commands in the history.|
<hr><div id='history.add'>
<hr>
<div id='history.add'>
<h4 class='heading'>
hilbish.history.add(cmd)
<a href="#history.add" class='heading-link'>
@ -36,7 +37,8 @@ Adds a command to the history.
</div>
<hr><div id='history.all'>
<hr>
<div id='history.all'>
<h4 class='heading'>
hilbish.history.all() -> table
<a href="#history.all" class='heading-link'>
@ -49,7 +51,8 @@ Retrieves all history as a table.
This function has no parameters.
</div>
<hr><div id='history.clear'>
<hr>
<div id='history.clear'>
<h4 class='heading'>
hilbish.history.clear()
<a href="#history.clear" class='heading-link'>
@ -62,7 +65,8 @@ Deletes all commands from the history.
This function has no parameters.
</div>
<hr><div id='history.get'>
<hr>
<div id='history.get'>
<h4 class='heading'>
hilbish.history.get(index)
<a href="#history.get" class='heading-link'>
@ -77,7 +81,8 @@ Retrieves a command from the history based on the `index`.
</div>
<hr><div id='history.size'>
<hr>
<div id='history.size'>
<h4 class='heading'>
hilbish.history.size() -> number
<a href="#history.size" class='heading-link'>

View File

@ -23,7 +23,8 @@ interactive usage or with the functions defined below for use in external runner
|<a href="#jobs.get">get(id) -> @Job</a>|Get a job object via its ID.|
|<a href="#jobs.last">last() -> @Job</a>|Returns the last added job to the table.|
<hr><div id='jobs.add'>
<hr>
<div id='jobs.add'>
<h4 class='heading'>
hilbish.jobs.add(cmdstr, args, execPath)
<a href="#jobs.add" class='heading-link'>
@ -51,7 +52,8 @@ hilbish.jobs.add('go build', {'go', 'build'}, '/usr/bin/go')
```
</div>
<hr><div id='jobs.all'>
<hr>
<div id='jobs.all'>
<h4 class='heading'>
hilbish.jobs.all() -> table[<a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;" id="lol">Job</a>]
<a href="#jobs.all" class='heading-link'>
@ -64,7 +66,8 @@ Returns a table of all job objects.
This function has no parameters.
</div>
<hr><div id='jobs.disown'>
<hr>
<div id='jobs.disown'>
<h4 class='heading'>
hilbish.jobs.disown(id)
<a href="#jobs.disown" class='heading-link'>
@ -79,7 +82,8 @@ Disowns a job. This simply deletes it from the list of jobs without stopping it.
</div>
<hr><div id='jobs.get'>
<hr>
<div id='jobs.get'>
<h4 class='heading'>
hilbish.jobs.get(id) -> <a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;" id="lol">Job</a>
<a href="#jobs.get" class='heading-link'>
@ -92,7 +96,8 @@ Get a job object via its ID.
This function has no parameters.
</div>
<hr><div id='jobs.last'>
<hr>
<div id='jobs.last'>
<h4 class='heading'>
hilbish.jobs.last() -> <a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;" id="lol">Job</a>
<a href="#jobs.last" class='heading-link'>

View File

@ -53,7 +53,8 @@ If you attempt to require and print the result (`print(require 'plugin')`), it w
|----|----|
|paths|A list of paths to search when loading native modules. This is in the style of Lua search paths and will be used when requiring native modules. Example: `?.so;?/?.so`|
<hr><div id='module.load'>
<hr>
<div id='module.load'>
<h4 class='heading'>
hilbish.module.load(path)
<a href="#module.load" class='heading-link'>

View File

@ -21,7 +21,8 @@ write command in Fennel.
|<a href="#runner.lua">lua(cmd)</a>|Evaluates `cmd` as Lua input. This is the same as using `dofile`|
|<a href="#runner.sh">sh(cmd)</a>|Runs a command in Hilbish's shell script interpreter.|
<hr><div id='runner.setMode'>
<hr>
<div id='runner.setMode'>
<h4 class='heading'>
hilbish.runner.setMode(cb)
<a href="#runner.setMode" class='heading-link'>
@ -39,7 +40,8 @@ as the higher level functions listed below this will handle it.
</div>
<hr><div id='runner.lua'>
<hr>
<div id='runner.lua'>
<h4 class='heading'>
hilbish.runner.lua(cmd)
<a href="#runner.lua" class='heading-link'>
@ -55,7 +57,8 @@ or `load`, but is appropriated for the runner interface.
</div>
<hr><div id='runner.sh'>
<hr>
<div id='runner.sh'>
<h4 class='heading'>
hilbish.runner.sh(cmd)
<a href="#runner.sh" class='heading-link'>

View File

@ -38,7 +38,8 @@ print(t.running) // true
|INTERVAL|Constant for an interval timer type|
|TIMEOUT|Constant for a timeout timer type|
<hr><div id='timers.create'>
<hr>
<div id='timers.create'>
<h4 class='heading'>
hilbish.timers.create(type, time, callback) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#timers.create" class='heading-link'>
@ -59,7 +60,8 @@ The function to run for the timer.
</div>
<hr><div id='timers.get'>
<hr>
<div id='timers.get'>
<h4 class='heading'>
hilbish.timers.get(id) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#timers.get" class='heading-link'>

View File

@ -18,7 +18,8 @@ The terminal library is a simple and lower level library for certain terminal in
|<a href="#setRaw">setRaw()</a>|Puts the terminal into raw mode.|
|<a href="#size">size()</a>|Gets the dimensions of the terminal. Returns a table with `width` and `height`|
<hr><div id='restoreState'>
<hr>
<div id='restoreState'>
<h4 class='heading'>
terminal.restoreState()
<a href="#restoreState" class='heading-link'>
@ -31,7 +32,8 @@ Restores the last saved state of the terminal
This function has no parameters.
</div>
<hr><div id='saveState'>
<hr>
<div id='saveState'>
<h4 class='heading'>
terminal.saveState()
<a href="#saveState" class='heading-link'>
@ -44,7 +46,8 @@ Saves the current state of the terminal.
This function has no parameters.
</div>
<hr><div id='setRaw'>
<hr>
<div id='setRaw'>
<h4 class='heading'>
terminal.setRaw()
<a href="#setRaw" class='heading-link'>
@ -57,7 +60,8 @@ Puts the terminal into raw mode.
This function has no parameters.
</div>
<hr><div id='size'>
<hr>
<div id='size'>
<h4 class='heading'>
terminal.size()
<a href="#size" class='heading-link'>

View File

@ -6,6 +6,22 @@ local Greenhouse = require 'nature.greenhouse'
local Page = require 'nature.greenhouse.page'
local docfuncs = require 'nature.doc'
local function strip(text, ...)
for _, pat in ipairs {...} do
text = text:gsub(pat, '\b')
end
return text
end
local function transformHTMLandMD(text)
return strip(text, '|||', '|%-%-%-%-|%-%-%-%-|')
:gsub('|(.-)|(.-)|', function(entry1, entry2)
return string.format('%s - %s', entry1, entry2)
end)
:gsub('<hr>', '{separator}')
end
commander.register('doc', function(args, sinks)
local moddocPath = hilbish.dataDir .. '/docs/'
local stat = pcall(fs.stat, '.git/refs/heads/extended-job-api')
@ -117,7 +133,7 @@ Available sections: ]] .. table.concat(modules, ', ')
end
local backtickOccurence = 0
local function formatDocText(d)
return d:gsub('```(%w+)\n(.-)```', function(lang, text)
return transformHTMLandMD(d):gsub('```(%w+)\n(.-)```', function(lang, text)
return docfuncs.renderCodeBlock(text)
end)
--[[

View File

@ -17,8 +17,8 @@ function M.renderCodeBlock(text)
end
for i, line in ipairs(lines) do
lines[i] = M.highlight(line:sub(0, longest))
.. string.rep(' ', longest - line:len())
lines[i] = ' ' .. M.highlight(line:sub(0, longest))
.. string.rep(' ', longest - line:len()) .. ' '
end
return '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'

View File

@ -21,6 +21,7 @@ function Greenhouse:new(sink)
self.sink = sink
self.pages = {}
self.curPage = 1
self.separator = ''
self.keybinds = {
['Up'] = function(self) self:scroll 'up' end,
['Down'] = function(self) self:scroll 'down' end,
@ -63,7 +64,8 @@ local function sub(str, limit)
:gsub('\x1b%[%d+;%d+%w', addOverhead)
:gsub('\x1b%[%d+%w', addOverhead)
return s:sub(0, limit + overhead)
return s:sub(0, utf8.offset(str, limit + overhead) or limit + overhead)
--return s:sub(0, limit + overhead)
end
function Greenhouse:draw()
@ -88,7 +90,8 @@ function Greenhouse:draw()
if i == offset + self.region.height - 1 then writer = self.sink.write end
writer(self.sink, sub(lines[i]:gsub('\t', ' '), self.region.width))
local line = lines[i]:gsub('{separator}', function() return self.separator:rep(self.region.width - 1) end)
writer(self.sink, sub(line:gsub('\t', ' '), self.region.width))
end
writer(self.sink, '\27[0m')
self:render()