tui.run
tui.run
Runs the main loop (input, dispatch, render, ticks) until tui.stop is called, then restores the terminal.
Notes
- Fires the
readyhook once, before the first frame. - Installs
INT/TERMtraps (clean up and exit 1) and aWINCHtrap for resizes. - Polls input every 0.05 s while tick listeners exist, else every 0.2 s (
TUI_INPUT_POLL_TIMEOUT,TUI_INPUT_IDLE_TIMEOUT). - Restores the terminal before it returns, so code after
tui.runprints to the normal screen.
Example
source lib/tui.sh
tui.init
tui.vsplit root top:1 bottom:3
tui.output bottom "hello"
tui.run
See also: tui.start
