Check out my first novel, midnight's simulacra!

Terminfo

From dankwiki
Revision as of 20:46, 12 July 2021 by Dank (talk | contribs)

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:

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.
  • RGB default background discovery query
  • 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

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:

  1. Run infocmp TERM on a machine with the database TERM, capturing the output to FILE
  2. Write the database entry TERM on the remote machine with tic FILE