Module greenhouse

Hilbish's environmentally friendly pager for long text

Added in v2.2.0

Introduction#

Greenhouse is a simple text scrolling handler (pager) for terminal programs. It can be set a specific region to do its scrolling and paging job, then the user can draw whatever outside it. You may use this as some kind of terminal UI library.

Functions#


new#

greenhouse.new(sink) -> nature.object

Creates a new Greenhouse pager.

Parameters#

hilbish.sink sink

Returns#

nature.object


render#

greenhouse.render()

This should be overloaded to render extra UI around Greenhouse.


resize#

greenhouse.resize()

Resizes Greenhouse to fit the terminal's size.


scroll#

greenhouse.scroll(direction, opts)

Since: 2.2.2

Scrolls the currently active page by one line, or a page height if specified.

Parameters#

string direction Either up or down

table opts

boolean page Whether the scroll amount should be the page height.


updateSpecial#

greenhouse.updateSpecial()

This function will be called when the special page is on and needs to be updated.