Check out my first novel, midnight's simulacra!
Terminfo: Difference between revisions
No edit summary |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
libterminfo provides something of an abstraction layer over various terminals; its support for old physical terminals is especially rich and essential. Some will tell you that the introduction of the ANSI standards have rendered terminfo unnecessary; they lie. With that said, it is not perfect, nor complete. | |||
As author of [[Notcurses]], I humbly beseech terminal creators: '''please, please, please keep your terminfo database up-to-date, and expose capabilities there!''' | |||
Terminal differences that aren't really handled in terminfo include: | Terminal differences that aren't really handled in terminfo include: | ||
* Precise mechanisms of <tt>setaf</tt>/<tt>setbf</tt> and interactions with palette-indexed color | * Precise mechanisms of <tt>setaf</tt>/<tt>setbf</tt> and interactions with palette-indexed color | ||
* Whether ANSI 39 "Default foreground color" / ANSI 49 "Default background color" can be used distinctly (you just get <tt>op</tt>, often defined as <tt>op=\E[39;49m</tt> | * Whether ANSI 39 "Default foreground color" / ANSI 49 "Default background color" can be used distinctly (you just get <tt>op</tt>, often defined as <tt>op=\E[39;49m</tt>). This might be addressed by the <tt>AX</tt> user capability. | ||
* Kitty's [https://github.com/kovidgoyal/kitty/issues/3185 weird replacement of RGB matching the default background color] and Alacritty's [https://github.com/alacritty/alacritty/pull/4196 recent opacity madness] | |||
* Kitty's [https://github.com/kovidgoyal/kitty/issues/3185 weird replacement of RGB matching the default background color] | |||
* Ordering of x/y coordinates when retrieving cursor location (this might be u6?) | * Ordering of x/y coordinates when retrieving cursor location (this might be u6?) | ||
Line 10: | Line 13: | ||
* A string which can match the terminal's reply to <tt>XTVERSION</tt>, to test whether we've got a terminfo database which doesn't correspond to the terminal we're actually using. | * A string which can match the terminal's reply to <tt>XTVERSION</tt>, to test whether we've got a terminfo database which doesn't correspond to the terminal we're actually using. | ||
* Individual enable/disable for each style. In particular, the ANSI <tt>CSI 22 m</tt> escape that disables bold/dim ought have a terminfo entry. | * Individual enable/disable for each style. In particular, the ANSI <tt>CSI 22 m</tt> escape that disables bold/dim ought have a terminfo entry. | ||
* <tt>XTPOPCOLORS</tt>/<tt>XTPUSHCOLORS</tt> | * <tt>XTPOPCOLORS</tt>/<tt>XTPUSHCOLORS</tt> | ||
* An abstraction over [https://github.com/hackerb9/lsix/issues/41 DECSDM] | * An abstraction over [https://github.com/hackerb9/lsix/issues/41 DECSDM] | ||
* Indications that the terminal draw various line- and box-drawing characters itself, rather than relying on the font. This might overlap somewhat with <tt>U8</tt>. | |||
* Dump the palette in one go, rather than making me query 256 entries. | |||
==Community extensions== | ==Community extensions== | ||
Line 23: | Line 27: | ||
* <tt>Sync</tt> [https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2 Synchronized Update Mode] (currently discovered via $2026 query) header and footer | * <tt>Sync</tt> [https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2 Synchronized Update Mode] (currently discovered via $2026 query) header and footer | ||
** <tt>\E[?2026%?%p1%{1}%-%tl%eh</tt> | ** <tt>\E[?2026%?%p1%{1}%-%tl%eh</tt> | ||
==Operating with terminfo== | |||
Dump a database entry with <tt>infocmp</tt>. This produces a source which can be compiled using <tt>tic</tt>. By default, <tt>tic</tt> writes a local database entry. The database structure varies between different environments, and ought not be relied upon. Moving a terminfo database TERM from one machine to another is thus best accomplished by: | |||
<ol> | |||
<li>Run <tt>infocmp TERM</tt> on a machine with the database TERM, capturing the output to FILE | |||
<li>Write the database entry TERM on the remote machine with <tt>tic</tt> FILE | |||
</ol> | |||
[[CATEGORY: Terminals]] | [[CATEGORY: Terminals]] |
Latest revision as of 20:19, 24 December 2021
libterminfo provides something of an abstraction layer over various terminals; its support for old physical terminals is especially rich and essential. Some will tell you that the introduction of the ANSI standards have rendered terminfo unnecessary; they lie. With that said, it is not perfect, nor complete.
As author of Notcurses, I humbly beseech terminal creators: please, please, please keep your terminfo database up-to-date, and expose capabilities there!
Terminal differences that aren't really handled in terminfo include:
- Precise mechanisms of setaf/setbf and interactions with palette-indexed color
- Whether ANSI 39 "Default foreground color" / ANSI 49 "Default background color" can be used distinctly (you just get op, often defined as op=\E[39;49m). This might be addressed by the AX user capability.
- Kitty's weird replacement of RGB matching the default background color and Alacritty's recent opacity madness
- Ordering of x/y coordinates when retrieving cursor location (this might be u6?)
Desired additions
- A string which can match the terminal's reply to XTVERSION, to test whether we've got a terminfo database which doesn't correspond to the terminal we're actually using.
- Individual enable/disable for each style. In particular, the ANSI CSI 22 m escape that disables bold/dim ought have a terminfo entry.
- XTPOPCOLORS/XTPUSHCOLORS
- An abstraction over DECSDM
- Indications that the terminal draw various line- and box-drawing characters itself, rather than relying on the font. This might overlap somewhat with U8.
- Dump the palette in one go, rather than making me query 256 entries.
Community extensions
These capabilities are not described in the most recent terminfo man page at the time of this writing, but are more or less widespread.
- smxx/rmxx begin and end strikeout mode (terminfo has os, a boolean capability indicating that the terminal supports strikeout)
- Smulx/rmulx begin and end extended underline mode (supports multiple underline forms)
- Su scrolls up some number of lines
- Sync Synchronized Update Mode (currently discovered via $2026 query) header and footer
- \E[?2026%?%p1%{1}%-%tl%eh
Operating with terminfo
Dump a database entry with infocmp. This produces a source which can be compiled using tic. By default, tic writes a local database entry. The database structure varies between different environments, and ought not be relied upon. Moving a terminfo database TERM from one machine to another is thus best accomplished by:
- Run infocmp TERM on a machine with the database TERM, capturing the output to FILE
- Write the database entry TERM on the remote machine with tic FILE