terminfo.node
v0.1.2
Published
Native terminfo and ncurses bindings for Node.js, providing fast access to every terminal capability supported by the terminfo database. Runs on Node.js, Deno, and Bun.
Downloads
304
Maintainers
Readme
[terminfo.node]
Native [terminfo] and [ncurses] bindings for [Deno], [Node.js], and [Bun].
Overview
This project provides a Node.js native addon for the [terminfo database] and a subset of [ncurses], exposing terminal capabilities and the ability to query or control terminal behavior in Deno, Bun, and Node.js applications alike.
Install
deno add jsr:terminfo.nodepnpm add jsr:terminfo.nodeyarn add jsr:terminfo.nodebunx jsr add terminfo.nodenpx jsr add terminfo.nodeUsage
1. Import [terminfo.node] and initialize terminfo
import ti from "terminfo.node";
// You MUST call .init([termname]) before any other API, else seg faults occur!
ti.init(); // uses $TERM by default
// or specify a termname explicitly
ti.init("xterm-256color"); // or "xterm", "vt100", "linux", "tmux", "rxvt", ...2. Use terminfo APIs!
import ti from "terminfo.node";
import { env, stdin, stdout } from "node:process";
import assert from "node:assert";
ti.init("xterm-256color");
// verifying the terminfo validity against process info
assert.strictEqual(ti.termname(), "xterm-256color");
assert.strictEqual(ti.columns(), stdout.columns);
assert.strictEqual(ti.lines(), stdout.rows);
assert.strictEqual(ti.has_colors(), stdout.getColorDepth() >= 8);
assert.strictEqual(ti.is_terminal_raw(), stdin.isRaw);Example: Clear screen and write text at specific position
import ti from "terminfo.node";
import { stdout } from "node:process";
// ensure terminfo is initialized (using $TERM by default)
ti.init();
const clear = ti.cap("clear");
stdout.write(ti.enter_alt_screen() + clear);
stdout.write(ti.cursor_save() + ti.cursor_hide());
stdout.write(ti.tparm("cup", 5, 10) + "Hello, Terminfo!");Example: request terminal info
import ti from "terminfo.node";
import assert from "node:assert";
// ensure terminfo is initialized
ti.init("xterm-256color");
console.log(ti.info());Example: query capability values
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
assert.strictEqual(ti.has_colors(), true);
assert.strictEqual(ti.num_colors(), 256);
assert.strictEqual(ti.has_mouse_events(), true);
// .tigetstr("<capname>") retrieves capability strings by capname
assert.strictEqual(ti.tigetstr("kmous"), "\x1b[<");
// .cap("<capname>") is a shorthand for .tigetstr("<capname>")
assert.strictEqual(ti.cap("cub1"), "\x1b[D");
assert.strictEqual(ti.cap("cuf"), "\x1b[%dC");
assert.strictEqual(ti.cap("el"), "\x1b[K");Example: use parameterized capabilities
import ti from "terminfo.node";
import { stdout } from "node:process";
ti.init();
const clear = ti.cap("clear");
stdout.write(ti.enter_alt_screen() + clear);
stdout.write(ti.cursor_save() + ti.cursor_hide());
// .tparm("<capname>", <params...>) is used to parameterize capabilities with
// a variadic number of parameters. It supports an arity of up to 9 arguments.
stdout.write(ti.tparm("cup", 5, 10) + "Hello, Terminfo!");[!NOTE]
The parameters are 0-indexed. If a capability is noted as 1-indexed in the [terminfo database] for a given termname, it is adjusted automatically by the native
tparm()implementation.import ti from "terminfo.node"; import assert from "node:assert"; ti.init("xterm-256color"); // 0-indexed input, 0-indexed output assert.strictEqual(ti.tparm("dl", 3), "\x1b[3M"); // 0-indexed input, 1-indexed output assert.strictEqual(ti.tparm("hpa", 15), "\x1b[16G");
API
- Miscellaneous
- Metadata & Init
- Colors
- Capabilities
- Keyboard
enable_keyboarddisable_keyboardkeyskeycodeunctrlresolve_key_codeget_key_countget_key_modifiersis_ctrlis_altis_shiftkey_a1key_a3key_b2key_backspacekey_begkey_btabkey_c1key_c3key_dckey_downkey_endkey_enterkey_f1key_f10key_f11key_f12key_f13key_f14key_f15key_f16key_f17key_f18key_f19key_f2key_f20key_f21key_f22key_f23key_f24key_f25key_f26key_f27key_f28key_f29key_f3key_f30key_f31key_f32key_f33key_f34key_f35key_f36key_f37key_f38key_f39key_f4key_f40key_f41key_f42key_f43key_f44key_f45key_f46key_f47key_f48key_f49key_f5key_f50key_f51key_f52key_f53key_f54key_f55key_f56key_f57key_f58key_f59key_f6key_f60key_f61key_f62key_f63key_f7key_f8key_f9key_homekey_ickey_leftkey_npagekey_ppagekey_rightkey_sdckey_sendkey_sfkey_shomekey_sickey_sleftkey_snextkey_spreviouskey_srkey_srightkey_up
- Termios
- Terminal Modes
- Mouse
- Modes
enter_alt_charset_modeenter_am_modeenter_blink_modeenter_bold_modeenter_ca_modeenter_dim_modeenter_insert_modeenter_italics_modeenter_reverse_modeenter_secure_modeenter_standout_modeenter_underline_modeexit_alt_charset_modeexit_am_modeexit_attribute_modeexit_ca_modeexit_insert_modeexit_italics_modeexit_standout_modeexit_underline_modemove_insert_modemove_standout_mode
- Strings
- Flags
- Control
- Screen
- Parameterized
- Cursor
- Numeric
Miscellaneous
has_alt_scroll
function has_alt_scroll(): boolean;Metadata & Init
init
Initialize the terminfo database for the specified terminal. If no terminal is
specified, the TERM environment variable is used, defaulting to "xterm" if
not set.
This function MUST be called before any other terminfo functions are used, as it sets up the necessary terminal capabilities.
Important: If the term parameter is an invalid or unsupported terminal
type, the underlying native implementation will crash the program with an
unhelpful Segmentation Fault error. There is currently no way to catch this
error in JavaScript, so ensure that the terminal type is valid before calling
this.
function init(term?: string): Result;info
Retrieve information about the currently initialized terminal.
The returned object contains various details about the configured terminal, such as its name, dimensions, and supported capabilities. See below for an example of the returned structure.
function info(): Info;termname
function termname(): string;longname
function longname(): string;baudrate
function baudrate(): number;columns
function columns(): number;erasechar
function erasechar(): number;killchar
function killchar(): number;list_supported_terms
function list_supported_terms(): string[];Colors
has_colors
function has_colors(): boolean;num_colors
function num_colors(): number;num_pairs
function num_pairs(): number;can_change_color
function can_change_color(): boolean;color_rgb
function color_rgb(i: number): ColorRgb;back_color_erase
screen erased with background color
| terminfo | termcap | human | type |
| -------- | ------- | ------------------ | --------- |
| bce | bce | back_color_erase | boolean |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetflag("bce");
assert.strictEqual(cap, true);max_colors
maximum number of colors on screen
| terminfo | termcap | human | type |
| -------- | -------- | ------------ | -------- |
| colors | colors | max_colors | number |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetnum("colors");
assert.strictEqual(cap, 256);orig_colors
Set all color pairs to the original ones
| terminfo | termcap | human | type |
| -------- | ------- | ------------- | -------- |
| oc | oc | orig_colors | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("oc");
assert.strictEqual(cap, "\\x1B]104\\007");Capabilities
tigetnum
function tigetnum(cap: string): number;tigetflag
function tigetflag(cap: string): number;tigetstr
function tigetstr(cap: string): string;tparm
function tparm(cap: string, ...args: number[]): string;sgr
function sgr(
bold: booleanish = 0,
underline: booleanish = 0,
blink: booleanish = 0,
reverse: booleanish = 0,
fg: number = -1,
bg: number = -1,
): string;box_char
function box_char(style: BoxCharStyle, part: BoxCharPart): string;cap
function cap(name: string): string;Keyboard
enable_keyboard
function enable_keyboard(): string;disable_keyboard
function disable_keyboard(): any;keys
function keys(): KeyDef[];keycode
function keycode(name: string): number;unctrl
function unctrl(input: string): string;resolve_key_code
function resolve_key_code(seq: string): number;get_key_count
function get_key_count(): number;get_key_modifiers
function get_key_modifiers(code: number): number;is_ctrl
function is_ctrl(code: number): boolean;is_alt
function is_alt(code: number): boolean;is_shift
function is_shift(code: number): boolean;key_a1
upper left of keypad
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| ka1 | K1 | key_a1 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("ka1");
assert.strictEqual(cap, "\\x1BOw");key_a3
upper right of keypad
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| ka3 | K3 | key_a3 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("ka3");
assert.strictEqual(cap, "\\x1BOy");key_b2
center of keypad
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kb2 | K2 | key_b2 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kb2");
assert.strictEqual(cap, "\\x1BOu");key_backspace
backspace key
| terminfo | termcap | human | type |
| -------- | ------- | --------------- | -------- |
| kbs | kbs | key_backspace | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kbs");
assert.strictEqual(cap, "^?");key_beg
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kbeg | kbeg | key_beg | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kbeg");
assert.strictEqual(cap, "\\x1BOE");key_btab
back tab (P)
| terminfo | termcap | human | type |
| -------- | ------- | ---------- | -------- |
| kcbt | bt | key_btab | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kcbt");
assert.strictEqual(cap, "\\x1B[Z");key_c1
lower left of keypad
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kc1 | K4 | key_c1 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kc1");
assert.strictEqual(cap, "\\x1BOq");key_c3
lower right of keypad
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kc3 | K5 | key_c3 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kc3");
assert.strictEqual(cap, "\\x1BOs");key_dc
delete-character key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kdch1 | kD | key_dc | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kdch1");
assert.strictEqual(cap, "\\x1B[3~");key_down
down-arrow key
| terminfo | termcap | human | type |
| -------- | ------- | ---------- | -------- |
| kcud1 | kd | key_down | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kcud1");
assert.strictEqual(cap, "\\x1BOB");key_end
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kend | kend | key_end | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kend");
assert.strictEqual(cap, "\\x1BOF");key_enter
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kent | kent | key_enter | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kent");
assert.strictEqual(cap, "\\x1BOM");key_f1
F1 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf1 | k1 | key_f1 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf1");
assert.strictEqual(cap, "\\x1BOP");key_f10
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf10 | kf10 | key_f10 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf10");
assert.strictEqual(cap, "\\x1B[21~");key_f11
F11 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf11 | kf11 | key_f11 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf11");
assert.strictEqual(cap, "\\x1B[23~");key_f12
F12 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf12 | kf12 | key_f12 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf12");
assert.strictEqual(cap, "\\x1B[24~");key_f13
F13 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf13 | kf13 | key_f13 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf13");
assert.strictEqual(cap, "\\x1B[1;2P");key_f14
F14 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf14 | kf14 | key_f14 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf14");
assert.strictEqual(cap, "\\x1B[1;2Q");key_f15
F15 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf15 | kf15 | key_f15 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf15");
assert.strictEqual(cap, "\\x1B[1;2R");key_f16
F16 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf16 | kf16 | key_f16 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf16");
assert.strictEqual(cap, "\\x1B[1;2S");key_f17
F17 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf17 | kf17 | key_f17 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf17");
assert.strictEqual(cap, "\\x1B[15;2~");key_f18
F18 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf18 | kf18 | key_f18 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf18");
assert.strictEqual(cap, "\\x1B[17;2~");key_f19
F19 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf19 | kf19 | key_f19 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf19");
assert.strictEqual(cap, "\\x1B[18;2~");key_f2
F2 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf2 | k2 | key_f2 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf2");
assert.strictEqual(cap, "\\x1BOQ");key_f20
F20 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf20 | kf20 | key_f20 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf20");
assert.strictEqual(cap, "\\x1B[19;2~");key_f21
F21 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf21 | kf21 | key_f21 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf21");
assert.strictEqual(cap, "\\x1B[20;2~");key_f22
F22 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf22 | kf22 | key_f22 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf22");
assert.strictEqual(cap, "\\x1B[21;2~");key_f23
F23 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf23 | kf23 | key_f23 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf23");
assert.strictEqual(cap, "\\x1B[23;2~");key_f24
F24 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf24 | kf24 | key_f24 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf24");
assert.strictEqual(cap, "\\x1B[24;2~");key_f25
F25 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf25 | kf25 | key_f25 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf25");
assert.strictEqual(cap, "\\x1B[1;5P");key_f26
F26 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf26 | kf26 | key_f26 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf26");
assert.strictEqual(cap, "\\x1B[1;5Q");key_f27
F27 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf27 | kf27 | key_f27 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf27");
assert.strictEqual(cap, "\\x1B[1;5R");key_f28
F28 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf28 | kf28 | key_f28 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf28");
assert.strictEqual(cap, "\\x1B[1;5S");key_f29
F29 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf29 | kf29 | key_f29 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf29");
assert.strictEqual(cap, "\\x1B[15;5~");key_f3
F3 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf3 | k3 | key_f3 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf3");
assert.strictEqual(cap, "\\x1BOR");key_f30
F30 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf30 | kf30 | key_f30 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf30");
assert.strictEqual(cap, "\\x1B[17;5~");key_f31
F31 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf31 | kf31 | key_f31 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf31");
assert.strictEqual(cap, "\\x1B[18;5~");key_f32
F32 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf32 | kf32 | key_f32 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf32");
assert.strictEqual(cap, "\\x1B[19;5~");key_f33
F33 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf33 | kf33 | key_f33 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf33");
assert.strictEqual(cap, "\\x1B[20;5~");key_f34
F34 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf34 | kf34 | key_f34 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf34");
assert.strictEqual(cap, "\\x1B[21;5~");key_f35
F35 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf35 | kf35 | key_f35 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf35");
assert.strictEqual(cap, "\\x1B[23;5~");key_f36
F36 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf36 | kf36 | key_f36 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf36");
assert.strictEqual(cap, "\\x1B[24;5~");key_f37
F37 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf37 | kf37 | key_f37 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf37");
assert.strictEqual(cap, "\\x1B[1;6P");key_f38
F38 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf38 | kf38 | key_f38 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf38");
assert.strictEqual(cap, "\\x1B[1;6Q");key_f39
F39 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf39 | kf39 | key_f39 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf39");
assert.strictEqual(cap, "\\x1B[1;6R");key_f4
F4 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf4 | k4 | key_f4 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf4");
assert.strictEqual(cap, "\\x1BOS");key_f40
F40 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf40 | kf40 | key_f40 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf40");
assert.strictEqual(cap, "\\x1B[1;6S");key_f41
F41 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf41 | kf41 | key_f41 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf41");
assert.strictEqual(cap, "\\x1B[15;6~");key_f42
F42 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf42 | kf42 | key_f42 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf42");
assert.strictEqual(cap, "\\x1B[17;6~");key_f43
F43 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf43 | kf43 | key_f43 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf43");
assert.strictEqual(cap, "\\x1B[18;6~");key_f44
F44 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf44 | kf44 | key_f44 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf44");
assert.strictEqual(cap, "\\x1B[19;6~");key_f45
F45 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf45 | kf45 | key_f45 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf45");
assert.strictEqual(cap, "\\x1B[20;6~");key_f46
F46 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf46 | kf46 | key_f46 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf46");
assert.strictEqual(cap, "\\x1B[21;6~");key_f47
F47 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf47 | kf47 | key_f47 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf47");
assert.strictEqual(cap, "\\x1B[23;6~");key_f48
F48 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf48 | kf48 | key_f48 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf48");
assert.strictEqual(cap, "\\x1B[24;6~");key_f49
F49 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf49 | kf49 | key_f49 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf49");
assert.strictEqual(cap, "\\x1B[1;3P");key_f5
F5 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf5 | k5 | key_f5 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf5");
assert.strictEqual(cap, "\\x1B[15~");key_f50
F50 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf50 | kf50 | key_f50 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf50");
assert.strictEqual(cap, "\\x1B[1;3Q");key_f51
F51 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf51 | kf51 | key_f51 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf51");
assert.strictEqual(cap, "\\x1B[1;3R");key_f52
F52 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf52 | kf52 | key_f52 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf52");
assert.strictEqual(cap, "\\x1B[1;3S");key_f53
F53 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf53 | kf53 | key_f53 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf53");
assert.strictEqual(cap, "\\x1B[15;3~");key_f54
F54 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf54 | kf54 | key_f54 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf54");
assert.strictEqual(cap, "\\x1B[17;3~");key_f55
F55 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf55 | kf55 | key_f55 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf55");
assert.strictEqual(cap, "\\x1B[18;3~");key_f56
F56 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf56 | kf56 | key_f56 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf56");
assert.strictEqual(cap, "\\x1B[19;3~");key_f57
F57 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf57 | kf57 | key_f57 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf57");
assert.strictEqual(cap, "\\x1B[20;3~");key_f58
F58 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf58 | kf58 | key_f58 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf58");
assert.strictEqual(cap, "\\x1B[21;3~");key_f59
F59 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf59 | kf59 | key_f59 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf59");
assert.strictEqual(cap, "\\x1B[23;3~");key_f6
F6 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf6 | k6 | key_f6 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf6");
assert.strictEqual(cap, "\\x1B[17~");key_f60
F60 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf60 | kf60 | key_f60 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf60");
assert.strictEqual(cap, "\\x1B[24;3~");key_f61
F61 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf61 | kf61 | key_f61 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf61");
assert.strictEqual(cap, "\\x1B[1;4P");key_f62
F62 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf62 | kf62 | key_f62 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf62");
assert.strictEqual(cap, "\\x1B[1;4Q");key_f63
F63 function key
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kf63 | kf63 | key_f63 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf63");
assert.strictEqual(cap, "\\x1B[1;4R");key_f7
F7 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf7 | k7 | key_f7 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf7");
assert.strictEqual(cap, "\\x1B[18~");key_f8
F8 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf8 | k8 | key_f8 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf8");
assert.strictEqual(cap, "\\x1B[19~");key_f9
F9 function key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kf9 | k9 | key_f9 | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kf9");
assert.strictEqual(cap, "\\x1B[20~");key_home
home key
| terminfo | termcap | human | type |
| -------- | ------- | ---------- | -------- |
| khome | kh | key_home | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("khome");
assert.strictEqual(cap, "\\x1BOH");key_ic
insert-character key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kich1 | kI | key_ic | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kich1");
assert.strictEqual(cap, "\\x1B[2~");key_left
left-arrow key
| terminfo | termcap | human | type |
| -------- | ------- | ---------- | -------- |
| kcub1 | kl | key_left | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kcub1");
assert.strictEqual(cap, "\\x1BOD");key_npage
next-page key
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| knp | kN | key_npage | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("knp");
assert.strictEqual(cap, "\\x1B[6~");key_ppage
previous-page key
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kpp | kP | key_ppage | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kpp");
assert.strictEqual(cap, "\\x1B[5~");key_right
right-arrow key
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kcuf1 | kr | key_right | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kcuf1");
assert.strictEqual(cap, "\\x1BOC");key_sdc
Represents the Shift+dc key combination.
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kDC | kDC | key_sdc | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kDC");
assert.strictEqual(cap, "\\x1B[3;2~");key_send
Represents the Shift+end key combination.
| terminfo | termcap | human | type |
| -------- | ------- | ---------- | -------- |
| kEND | kEND | key_send | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kEND");
assert.strictEqual(cap, "\\x1B[1;2F");key_sf
scroll-forward key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kind | kind | key_sf | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kind");
assert.strictEqual(cap, "\\x1B[1;2B");key_shome
Represents the Shift+home key combination.
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kHOM | kHOM | key_shome | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kHOM");
assert.strictEqual(cap, "\\x1B[1;2H");key_sic
Represents the Shift+ic key combination.
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| kIC | kIC | key_sic | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kIC");
assert.strictEqual(cap, "\\x1B[2;2~");key_sleft
Represents the Shift+left key combination.
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kLFT | kLFT | key_sleft | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kLFT");
assert.strictEqual(cap, "\\x1B[1;2D");key_snext
Represents the Shift+npage key combination.
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kNXT | kNXT | key_snext | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kNXT");
assert.strictEqual(cap, "\\x1B[6;2~");key_sprevious
Represents the Shift+ppage key combination.
| terminfo | termcap | human | type |
| -------- | ------- | --------------- | -------- |
| kPRV | kPRV | key_sprevious | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kPRV");
assert.strictEqual(cap, "\\x1B[5;2~");key_sr
scroll-backward key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kri | kri | key_sr | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kri");
assert.strictEqual(cap, "\\x1B[1;2A");key_sright
Represents the Shift+right key combination.
| terminfo | termcap | human | type |
| -------- | ------- | ------------ | -------- |
| kRIT | kRIT | key_sright | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kRIT");
assert.strictEqual(cap, "\\x1B[1;2C");key_up
up-arrow key
| terminfo | termcap | human | type |
| -------- | ------- | -------- | -------- |
| kcuu1 | ku | key_up | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kcuu1");
assert.strictEqual(cap, "\\x1BOA");Termios
stdin_fd
function stdin_fd(): number;stdout_fd
function stdout_fd(): number;stderr_fd
function stderr_fd(): number;isatty
function isatty(fd: number): boolean;tcgetattr
function tcgetattr(fd?: number): Termios;tcsetattr
function tcsetattr(termios_p: Partial<Termios>, fd?: number): void;tcflush
function tcflush(fd: number, queue?: number): void;get_termios
function get_termios(fd?: number): Termios;set_termios
function set_termios(termios: Partial<Termios>, fd?: number): void;get_termios_constants
function get_termios_constants(): TermiosConstants;is_terminal_raw
function is_terminal_raw(): boolean;is_terminal_cbreak
function is_terminal_cbreak(): boolean;is_terminal_normal
function is_terminal_normal(): boolean;enter_raw_mode
function enter_raw_mode(): Result;enter_cbreak_mode
function enter_cbreak_mode(): Result;exit_raw_mode
function exit_raw_mode(): Result;exit_cbreak_mode
function exit_cbreak_mode(): Result;restore
function restore(): Result;Terminal Modes
enter_normal_mode
function enter_normal_mode(): Result;request_mode_status
function request_mode_status(
mode: number,
dec?: booleanish,
): ModeStatus;is_mode_supported
function is_mode_supported(mode: number, dec?: booleanish): boolean;is_mode_settable
function is_mode_settable(mode: number, dec?: booleanish): boolean;is_mode_enabled
function is_mode_enabled(mode: number, dec?: booleanish): boolean;is_mode_disabled
function is_mode_disabled(mode: number, dec?: booleanish): boolean;is_mode_permanent
function is_mode_permanent(mode: number, dec?: booleanish): boolean;has_alt_screen
function has_alt_screen(): boolean;has_bracketed_paste
function has_bracketed_paste(): boolean;has_button_events
function has_button_events(): boolean;has_motion_events
function has_motion_events(): boolean;has_focus_events
function has_focus_events(): boolean;Mouse
has_mouse_support
function has_mouse_support(): boolean;has_mouse_events
function has_mouse_events(): boolean;has_x10_mouse
function has_x10_mouse(): boolean;has_vt200_mouse
function has_vt200_mouse(): boolean;has_highlight_mouse
function has_highlight_mouse(): boolean;has_utf8_mouse
function has_utf8_mouse(): boolean;has_sgr_mouse
function has_sgr_mouse(): boolean;has_urxvt_mouse
function has_urxvt_mouse(): boolean;has_pixel_mouse
function has_pixel_mouse(): boolean;has_mouse
function has_mouse(): boolean;enable_mouse
function enable_mouse(): string;disable_mouse
function disable_mouse(): string;parse_mouse
function parse_mouse(
seq: string,
protocol: MouseProtocol | undefined,
): MouseParsed | undefined;get_mouse_x
function get_mouse_x(): number;get_mouse_y
function get_mouse_y(): number;get_mouse_button
function get_mouse_button(): number;get_mouse_action
function get_mouse_action(): number;get_mouse_modifiers
function get_mouse_modifiers(): number;key_mouse
| terminfo | termcap | human | type |
| -------- | ------- | ----------- | -------- |
| kmous | kmous | key_mouse | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("kmous");
assert.strictEqual(cap, "\\x1B[<");Modes
enter_alt_charset_mode
start alternate character set (P)
| terminfo | termcap | human | type |
| -------- | ------- | ------------------------ | -------- |
| smacs | as | enter_alt_charset_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("smacs");
assert.strictEqual(cap, "\\x1B(0");enter_am_mode
turn on automatic margins
| terminfo | termcap | human | type |
| -------- | ------- | --------------- | -------- |
| smam | smam | enter_am_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("smam");
assert.strictEqual(cap, "\\x1B[?7h");enter_blink_mode
turn on blinking
| terminfo | termcap | human | type |
| -------- | ------- | ------------------ | -------- |
| blink | mb | enter_blink_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("blink");
assert.strictEqual(cap, "\\x1B[5m");enter_bold_mode
turn on bold (extra bright) mode
| terminfo | termcap | human | type |
| -------- | ------- | ----------------- | -------- |
| bold | md | enter_bold_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("bold");
assert.strictEqual(cap, "\\x1B[1m");enter_ca_mode
string to start programs using cup
| terminfo | termcap | human | type |
| -------- | ------- | --------------- | -------- |
| smcup | ti | enter_ca_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("smcup");
assert.strictEqual(cap, "\\x1B[?1049h\\x1B[22;0;0t");enter_dim_mode
turn on half-bright mode
| terminfo | termcap | human | type |
| -------- | ------- | ---------------- | -------- |
| dim | mh | enter_dim_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("dim");
assert.strictEqual(cap, "\\x1B[2m");enter_insert_mode
enter insert mode
| terminfo | termcap | human | type |
| -------- | ------- | ------------------- | -------- |
| smir | im | enter_insert_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("smir");
assert.strictEqual(cap, "\\x1B[4h");enter_italics_mode
Enter italic mode
| terminfo | termcap | human | type |
| -------- | ------- | -------------------- | -------- |
| sitm | sitm | enter_italics_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("sitm");
assert.strictEqual(cap, "\\x1B[3m");enter_reverse_mode
turn on reverse video mode
| terminfo | termcap | human | type |
| -------- | ------- | -------------------- | -------- |
| rev | rev | enter_reverse_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rev");
assert.strictEqual(cap, "\\x1B[7m");enter_secure_mode
turn on blank mode (characters invisible)
| terminfo | termcap | human | type |
| -------- | ------- | ------------------- | -------- |
| invis | invis | enter_secure_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("invis");
assert.strictEqual(cap, "\\x1B[8m");enter_standout_mode
begin standout mode
| terminfo | termcap | human | type |
| -------- | ------- | --------------------- | -------- |
| smso | smso | enter_standout_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("smso");
assert.strictEqual(cap, "\\x1B[7m");enter_underline_mode
begin underline mode
| terminfo | termcap | human | type |
| -------- | ------- | ---------------------- | -------- |
| smul | us | enter_underline_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("smul");
assert.strictEqual(cap, "\\x1B[4m");exit_alt_charset_mode
end alternate character set (P)
| terminfo | termcap | human | type |
| -------- | ------- | ----------------------- | -------- |
| rmacs | ae | exit_alt_charset_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rmacs");
assert.strictEqual(cap, "\\x1B(B");exit_am_mode
turn off automatic margins
| terminfo | termcap | human | type |
| -------- | ------- | -------------- | -------- |
| rmam | rmam | exit_am_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rmam");
assert.strictEqual(cap, "\\x1B[?7l");exit_attribute_mode
turn off all attributes
| terminfo | termcap | human | type |
| -------- | ------- | --------------------- | -------- |
| sgr0 | sgr0 | exit_attribute_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("sgr0");
assert.strictEqual(cap, "\\x1B(B\\x1B[m");exit_ca_mode
strings to end programs using cup
| terminfo | termcap | human | type |
| -------- | ------- | -------------- | -------- |
| rmcup | te | exit_ca_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rmcup");
assert.strictEqual(cap, "\\x1B[?1049l\\x1B[23;0;0t");exit_insert_mode
exit insert mode
| terminfo | termcap | human | type |
| -------- | ------- | ------------------ | -------- |
| rmir | ei | exit_insert_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rmir");
assert.strictEqual(cap, "\\x1B[4l");exit_italics_mode
End italic mode
| terminfo | termcap | human | type |
| -------- | ------- | ------------------- | -------- |
| ritm | ritm | exit_italics_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("ritm");
assert.strictEqual(cap, "\\x1B[23m");exit_standout_mode
exit standout mode
| terminfo | termcap | human | type |
| -------- | ------- | -------------------- | -------- |
| rmso | se | exit_standout_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rmso");
assert.strictEqual(cap, "\\x1B[27m");exit_underline_mode
exit underline mode
| terminfo | termcap | human | type |
| -------- | ------- | --------------------- | -------- |
| rmul | ue | exit_underline_mode | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("rmul");
assert.strictEqual(cap, "\\x1B[24m");move_insert_mode
safe to move while in insert mode
| terminfo | termcap | human | type |
| -------- | ------- | ------------------ | --------- |
| mir | mir | move_insert_mode | boolean |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetflag("mir");
assert.strictEqual(cap, true);move_standout_mode
safe to move while in standout mode
| terminfo | termcap | human | type |
| -------- | ------- | -------------------- | --------- |
| msgr | msgr | move_standout_mode | boolean |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetflag("msgr");
assert.strictEqual(cap, true);Strings
carriage_return
carriage return (P*) (P*)
| terminfo | termcap | human | type |
| -------- | ------- | ----------------- | -------- |
| cr | cr | carriage_return | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("cr");
assert.strictEqual(cap, "\\r");clear_all_tabs
clear all tab stops (P)
| terminfo | termcap | human | type |
| -------- | ------- | ---------------- | -------- |
| tbc | ct | clear_all_tabs | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("tbc");
assert.strictEqual(cap, "\\x1B[3g");clear_margins
clear right and left soft margins
| terminfo | termcap | human | type |
| -------- | ------- | --------------- | -------- |
| mgc | mgc | clear_margins | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
const cap = ti.tigetstr("mgc");
assert.strictEqual(cap, "\\x1B[?69l");clr_bol
Clear to beginning of line
| terminfo | termcap | human | type |
| -------- | ------- | --------- | -------- |
| el1 | el1 | clr_bol | string |
import ti from "terminfo.node";
import assert from "node:assert";
ti.init("xterm-256color");
co