diff --git a/doc/manual.html b/doc/manual.html
index 1f317af..a511c91 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -4097,8 +4097,258 @@ which automatically removes the file when the program ends.
Teliva includes curses facilities identical to Lua's lcurses
library. As there, the top-level module is called curses
. All apps
-start with the terminal window initialized using curses.initscr()
.
-Look at the sample apps for example usage.
+start with the terminal window initialized using
+curses.initscr
. Look at the
+sample apps for example usage.
+
+
+
+
curses.initscr ()
+Initializes the current terminal to stop scrolling and enable moving the +cursor. You shouldn't need to ever call this from Teliva; it's always called +for you before an app is loaded. + + +
+
curses.stdscr ()
+Returns a window object for the current terminal. Most curses
+operations require a window. Windows are an app's gateway to both print to
+screen and read keys from keyboard. Teliva's template.tlv for new applications
+saves the result in a global called Window
, so you should be able
+to avoid calling stdscr
directly most of the time.
+
+
+Curses supports multiple and nested windows. They haven't been tried +yet in the context of Teliva, but they're expected to work. Please report your +experience if you try them out. + + +
+
window {}
+Creates a fake window suitable for passing around in tests. The table passed
+in should have two keys: a kbd
+containing a keyboard, and a scr
+containing a screen.
+
+
+This helper is implemented in template.tlv, so new apps should pick it up from +there. + + +
+
kbd (str)
+Creates a fake keyboard suitable for passing into
+window
with the characters in
+str
already “typed in”.
+
+
+
+
+This helper is implemented in template.tlv, so new apps should pick it up from +there. + + +
+
scr {}
+Creates a fake screen suitable for passing into
+window
. The table passed in should
+contain two keys: a height h
and a width w
.
+
+
+
+This helper is implemented in template.tlv, so new apps should pick it up from +there. + + +
+
window:clear ()
+Clears all prints in window
.
+
+
+
+
window:refresh ()
+Flushes all prints to window
. Also redraws the Teliva menu.
+
+
+
+
window:addch (c)
+Prints character c
with
+the current attributes
+at the cursor in window
. May not be visible until
+window:refresh
is called.
+
+
+
+
window:mvaddch (y, x, c)
+Moves window
's cursor to (x
, y
) before
+printing character c
to it with
+the current attributes.
+May not be visible until window:refresh
+is called.
+
+
+
+
window:addstr (str)
+Prints string str
with
+the current attributes
+at the cursor in window
. May not be visible until
+window:refresh
is called.
+
+
+
+
window:mvaddstr (y, x, str)
+Moves window
's cursor to (x
, y
) before
+printing string str
to it with
+the current attributes.
+May not be visible until window:refresh
is called.
+
+
+
+
window:getmaxyx ()
+Returns window
's height
and width
.
+
+
+
+
window:getyx ()
+Returns window
's cursor coordinates y
and
+x
.
+
+
+
+
window:attrset (attr)
+Sets the current attributes
+for future prints to window
. Attributes can be one of:
+
+
curses.A_NORMAL
: disables all other attributes.
+curses.A_BOLD
+curses.A_REVERSE
: swaps foreground and background colors.
+curses.color_pair(n)
for some integer n
: color
+pair n
which must have been initialized using
+curses.init_pair
.
++Since Lua 5.1 has no bitwise operations, this function currently only supports +setting a single attribute. + + +
+
window:attron (attr)
+Adds the given attribute
+to the set of current attributes for future prints to window
. For
+the list of available attributes see window:attrset
.
+
+
+Since Lua 5.1 has no bitwise operations, this function currently only supports +adding a single attribute at a time. + + +
+
window:attroff (attr)
+Removes the given attribute
+from the set of current attributes for future prints to window
.
+the list of available attributes see window:attrset
.
+
+
+Since Lua 5.1 has no bitwise operations, this function currently only supports +removing a single attribute at a time. + + +
+
curses.init_pair (i, fg, bg)
+Initializes color pair i
to (foreground
, background
).
+Now calls to curses.color_pair(i) will
+yield the attributes for that color pair.
+
+
+
+
curses.color_pair (i)
+Returns attributes for a (foreground
, background
)
+pair of colors suitable to pass into
+window:attrset
,
+window:attron
and
+window:attroff
.
+
+
+
+
window:getch ()
+Returns a character from the keyboard. Waits for a key to be pressed by
+default, but this behavior can be changed by calling window:nodelay(true)
.
+
+
+window:getch
is the only supported way to get input from
+keyboard in Teliva, handling Teliva's menu and so on.
+
+
+
+
window:nodelay (on)
+Forces window:getch()
to be non-blocking.
+
+
+
json
). It also includes a variant in module jsonf
that can
read JSON from channels opened by
-start_reading.
+start_reading
.
json.encode (value)
task
. It also transparently starts up
-task.scheduler
for all apps. See sieve.tlv for a basic example.
+task.scheduler
for all apps.
+See sieve.tlv for a basic example.
task.spawn (fun, [...])
task
. It also transparently starts up
Run fun
as a coroutine with given parameters. You should use this
-instead of coroutine.create()
.
+instead of coroutine.create
.
@@ -4215,7 +4466,8 @@ Create a new channel with given size (which defaults to 0).
Write value
to a channel. Blocks the current coroutine if the
channel is already full. (Channels with size 0 always block if there isn't
-already a coroutine trying to recv()
from them.)
+already a coroutine trying to recv
+from them.)
@@ -4225,10 +4477,10 @@ already a coroutine trying to recv()
from them.)
Read a value from a channel. Blocks the current coroutine if the
channel is empty and there isn't already a coroutine trying to
-send()
to them.
+send
to them.
-
+