Terminfo
Created on 2021-01-27T13:49:13-06:00
Where are they?
~/.terminfo/?/*
/usr/local/share/terminfo/?/*
/usr/share/terminfo/?/*
/etc/terminfo/?/*
Parsing
Comments indicated with "#" until end of line.
Comma separated values.
Commas escaped with a backslash.
Whitespace which appears after a comma is ignored.
Newlines and leading tabs are ignored when parsing; but if a definition is broken across lines then each line after the first must start with whitespace.
Terminal name
The first capability takes the form of text separated by pipes. Each entry is a name for the terminal code, such as "xterm-256color." There should be at least two entries: the logical name of the terminal code such as "xterm-256color" and the final entry is the long description which may contain uppercase letters and whitespace.
Capability names
A capability name which begins with a period is "commented out."
Capability values
foo: this capability has no parameters and is present
color#123: this capability has a numeric parameter, in this case there are 123 colors
foo=bar: this capability is implemented by emitting the characters "bar"
Percent codes
%%: literal %
%[[:]flags][width[.precision]][doxXs]: flags are -+# and space, may use :- instead of - to avoid conflicts with %-; printf-like
%c: printf("%c", pop())
%s: printf("%s", pop())
%p[0-9]: push [0-9]th parameter
%P[a-z]: set dnamic variable a-z to(pop)
%g[a-z]: push(dynamic variable a-z)
%P[A-Z]: set static variable A-Z to(pop)
%g[A-Z]: push(static variable A-Z)
%'c': push(character literal c)
%{nn}: push(integer literal nn)
%l: length of string(pop)
%+: push(pop + pop)
%-: push(pop - pop)
%*: push(pop * pop)
%/: push(pop / pop)
%m: push(pop modulo pop)
%&: push(pop and pop)
%|: push(pop or pop)
%^: push(pop xor pop)
%A: logical and
%O: logical or
%!: logical not
%~: bitwise not
%i: add 1 to first two parameters
%? expression %t then %e else %; : else branch is optional; traditional "condition ? yea : nay" if/then/else branch
Numbers
Numeric values are specified in decimal, octal or hexadecimal, as in 200, 0200, 0xff, or 0xFF.
Escape sequences
\e, \E: ESCAPE
^x: control-x for any x
\n: new line
\l: line feed
\r: return
\t: tab
\b: backspace
\f: form feed
\s: space
\^: literal ^
\\: literal \
\,: literal ,
\:: literal :
\0: ASCII code 200, a null.
$
Delays
Delays may have at most one decimal of precision.
A * suffix means the delay SHOULD apply for each line affected by the operation.
A / suffix means the delay is a hard limit and WILL be applied for each line affected regardless of what the application does.
Capabilities
am: automatic linefeed when writing off edge of terminal
cols#n: number of columns in terminal
el(): clear to end of line
lines#n: number of lines in the terminal
clear(): clears terminal and resets cursor to home position
os: terminal overstrikes instead of deleting cells
hc(): ??
cr(): carriage return; return cursor to start of current line
bel(): audible beep
cub1(): move caret back one witout hanging the content of any cell
cuu1(): move caret up one line witout hanging the content of any cell
cuf1(): move caret forward one witout hanging the content of any cell
cud1(): move caret down one line witout hanging the content of any cell
bw: ???
ind: ???
ri: ???
indn(n): ??? scroll n lines
rin(n): ??? scroll n lines
scrolling down: move to top left corner and send ri()
scrolling up: move to bottom left corner and send ind()