Is zero-based indexes for col, row values.
`
CSI Pm m Character Attributes (SGR).
Ps = 0 -> Normal (default).
Ps = 1 -> Bold.
Ps = 4 -> Underlined.
Ps = 5 -> Blink (appears as Bold).
Ps = 7 -> Inverse.
Ps = 8 -> Invisible, i.e., hidden (VT300).
Ps = 2 2 -> Normal (neither bold nor faint).
Ps = 2 4 -> Not underlined.
Ps = 2 5 -> Steady (not blinking).
Ps = 2 7 -> Positive (not inverse).
Ps = 2 8 -> Visible, i.e., not hidden (VT300).
Ps = 3 0 -> Set foreground color to Black.
Ps = 3 1 -> Set foreground color to Red.
Ps = 3 2 -> Set foreground color to Green.
Ps = 3 3 -> Set foreground color to Yellow.
Ps = 3 4 -> Set foreground color to Blue.
Ps = 3 5 -> Set foreground color to Magenta.
Ps = 3 6 -> Set foreground color to Cyan.
Ps = 3 7 -> Set foreground color to White.
Ps = 3 9 -> Set foreground color to default (original).
Ps = 4 0 -> Set background color to Black.
Ps = 4 1 -> Set background color to Red.
Ps = 4 2 -> Set background color to Green.
Ps = 4 3 -> Set background color to Yellow.
Ps = 4 4 -> Set background color to Blue.
Ps = 4 5 -> Set background color to Magenta.
Ps = 4 6 -> Set background color to Cyan.
Ps = 4 7 -> Set background color to White.
Ps = 4 9 -> Set background color to default (original).
If 16-color support is compiled, the following apply. Assume that xterm's resources are set so that the ISO color codes are the first 8 of a set of 16. Then the aixterm colors are the bright versions of the ISO colors: Ps = 9 0 -> Set foreground color to Black. Ps = 9 1 -> Set foreground color to Red. Ps = 9 2 -> Set foreground color to Green. Ps = 9 3 -> Set foreground color to Yellow. Ps = 9 4 -> Set foreground color to Blue. Ps = 9 5 -> Set foreground color to Magenta. Ps = 9 6 -> Set foreground color to Cyan. Ps = 9 7 -> Set foreground color to White. Ps = 1 0 0 -> Set background color to Black. Ps = 1 0 1 -> Set background color to Red. Ps = 1 0 2 -> Set background color to Green. Ps = 1 0 3 -> Set background color to Yellow. Ps = 1 0 4 -> Set background color to Blue. Ps = 1 0 5 -> Set background color to Magenta. Ps = 1 0 6 -> Set background color to Cyan. Ps = 1 0 7 -> Set background color to White.
If xterm is compiled with the 16-color support disabled, it supports the following, from rxvt: Ps = 1 0 0 -> Set foreground and background color to default.
If 88- or 256-color support is compiled, the following apply.
Ps = 3 8 ; 5 ; Ps -> Set foreground color to the second
Ps.
Ps = 4 8 ; 5 ; Ps -> Set background color to the second
Ps.
`
`
CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v
Copy Rectangular Area (DECCRA, VT400 and up).
Pt; Pl; Pb; Pr denotes the rectangle.
Pp denotes the source page.
Pt; Pl denotes the target location.
Pp denotes the target page.
NOTE: xterm doesn't enable this code by default.
`
CSI Ps ; Ps H Cursor Position [ row;column ] (default = [ 1,1 ]) (CUP).
CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
Cursor Down n
times, by default 1.
Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
CSI Ps E
Cursor Next Line Ps Times (default = 1) (CNL).
same as CSI Ps B ?
CSI Ps ; Ps H Cursor Position [ row;column ] (default = [ 1,1 ]) (CUP).
see setCursorStyle
CSI P m SP ~
Delete P s Column(s) (default = 1) (DECDC), VT420 and up
NOTE: xterm doesn't enable this code by default.
CSI Ps n Device Status Report (DSR).
Ps = 5 -> Status Report. Result (``OK'') is
CSI 0 n
Ps = 6 -> Report Cursor Position (CPR) [row;column].
Result is
CSI r ; c R
CSI ? Ps n
Device Status Report (DSR, DEC-specific).
Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI
? r ; c R (assumes page is zero).
Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).
or CSI ? 1 1 n (not ready).
Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)
or CSI ? 2 1 n (locked).
Ps = 2 6 -> Report Keyboard status as
CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).
The last two parameters apply to VT400 & up, and denote key-
board ready and LK01 respectively.
Ps = 5 3 -> Report Locator status as
CSI ? 5 3 n Locator available, if compiled-in, or
CSI ? 5 0 n No Locator, if not.
OSC Ps ; Pt ST OSC Ps ; Pt BEL Change dynamic colors
`
CSI Pt ; Pl ; Pb ; Pr ' w
Enable Filter Rectangle (DECEFR), VT420 and up.
Parameters are [top;left;bottom;right].
Defines the coordinates of a filter rectangle and activates
it. Anytime the locator is detected outside of the filter
rectangle, an outside rectangle event is generated and the
rectangle is disabled. Filter rectangles are always treated
as "one-shot" events. Any parameters that are omitted default
to the current locator position. If all parameters are omit-
ted, any locator motion will be reported. DECELR always can-
cels any prevous rectangle definition.
`
`
CSI Ps ; Pu ' z
Enable Locator Reporting (DECELR).
Valid values for the first parameter:
Ps = 0 -> Locator disabled (default).
Ps = 1 -> Locator enabled.
Ps = 2 -> Locator enabled for one report, then disabled.
The second parameter specifies the coordinate unit for locator
reports.
Valid values for the second parameter:
Pu = 0 <- or omitted -> default to character cells.
Pu = 1 <- device physical pixels.
Pu = 2 <- character cells.
`
CSI Pc; Pt; Pl; Pb; Pr$ x
Fill Rectangular Area (DECFRA), VT420 and up.
Pc is the character to use.
Pt; Pl; Pb; Pr denotes the rectangle.
NOTE: xterm doesn't enable this code by default.
Flushes the buffer.
Example Call:
program.getCursor(function(err, data) {
program.log('getCursor', data);
});
example call:
program.getCursor(function(err, data) {
program.log('getCursor', data);
program.write(util.inspect(data));
});
Queries whether the terminal has the capability name
.
CSI Ps ; Ps ; Ps ; Ps ; Ps T
Initiate highlight mouse tracking. Parameters are
[func;startx;starty;firstrow;lastrow]. See the section Mouse
Tracking.
CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH).
CSI P m SP }
Insert P s Column(s) (default = 1) (DECIC), VT420 and up.
NOTE: xterm doesn't enable this code by default.
Writes arguments to log file passed in options.
`
CSI Ps ; Ps ; Ps t
Window manipulation (from dtterm, as well as extensions).
These controls may be disabled using the allowWindowOps
resource. Valid values for the first (and any additional
parameters) are:
Ps = 1 -> De-iconify window.
Ps = 2 -> Iconify window.
Ps = 3 ; x ; y -> Move window to [x, y].
Ps = 4 ; height ; width -> Resize the xterm window to
height and width in pixels.
Ps = 5 -> Raise the xterm window to the front of the stack-
ing order.
Ps = 6 -> Lower the xterm window to the bottom of the
stacking order.
Ps = 7 -> Refresh the xterm window.
Ps = 8 ; height ; width -> Resize the text area to
[height;width] in characters.
Ps = 9 ; 0 -> Restore maximized window.
Ps = 9 ; 1 -> Maximize window (i.e., resize to screen
size).
Ps = 1 0 ; 0 -> Undo full-screen mode.
Ps = 1 0 ; 1 -> Change to full-screen.
Ps = 1 1 -> Report xterm window state. If the xterm window
is open (non-iconified), it returns CSI 1 t . If the xterm
window is iconified, it returns CSI 2 t .
Ps = 1 3 -> Report xterm window position. Result is CSI 3
; x ; y t
Ps = 1 4 -> Report xterm window in pixels. Result is CSI
4 ; height ; width t
Ps = 1 8 -> Report the size of the text area in characters.
Result is CSI 8 ; height ; width t
Ps = 1 9 -> Report the size of the screen in characters.
Result is CSI 9 ; height ; width t
Ps = 2 0 -> Report xterm window's icon label. Result is
OSC L label ST
Ps = 2 1 -> Report xterm window's title. Result is OSC l
label ST
Ps = 2 2 ; 0 -> Save xterm icon and window title on
stack.
Ps = 2 2 ; 1 -> Save xterm icon title on stack.
Ps = 2 2 ; 2 -> Save xterm window title on stack.
Ps = 2 3 ; 0 -> Restore xterm icon and window title from
stack.
Ps = 2 3 ; 1 -> Restore xterm icon title from stack.
Ps = 2 3 ; 2 -> Restore xterm window title from stack.
Ps >= 2 4 -> Resize to Ps lines (DECSLPP).
Ps >= 2 4 -> Resize to Ps lines (DECSLPP).
`
`
Example call:
`
`
program.manipulateWindow(18, function(err:any, data:any) {
program.log('manipulateWindow', data);
});
`
triggered when native events in the host terminal window
triggered when the terminal window is resized.
triggered when the terminal window gains focus n the host window manager. For exmmple when the user switchst form another application to the terminal with ctrl-tab. Notice that these are native events, ocurring outside the terminal application.
triggered when the terminal window loose focus host window manager. For exmmple when the user switchs from the shell to another form another application . Notice that these are native events, ocurring outside the terminal application.
Received when blessed notices something untoward (output is not a tty, terminfo not found, etc).
CSI Ps ; Ps H Cursor Position [ row;column ] (default = [ 1,1 ]) (CUP).
Determines whether to include text attributes when writing.
`
CSI Ps ' |
Request Locator Position (DECRQLP).
Valid values for the parameter are:
Ps = 0 , 1 or omitted -> transmit a single DECLRP locator
report.
If Locator Reporting has been enabled by a DECELR, xterm will respond with a DECLRP Locator Report. This report is also generated on button up and down events if they have been enabled with a DECSLE, or when the locator is detected outside of a filter rectangle, if filter rectangles have been enabled with a DECEFR.
-> CSI Pe ; Pb ; Pr ; Pc ; Pp & w
Parameters are [event;button;row;column;page].
Valid values for the event:
Pe = 0 -> locator unavailable - no other parameters sent.
Pe = 1 -> request - xterm received a DECRQLP.
Pe = 2 -> left button down.
Pe = 3 -> left button up.
Pe = 4 -> middle button down.
Pe = 5 -> middle button up.
Pe = 6 -> right button down.
Pe = 7 -> right button up.
Pe = 8 -> M4 button down.
Pe = 9 -> M4 button up.
Pe = 1 0 -> locator outside filter rectangle.
button'' parameter is a bitmask indicating which buttons are
pressed:
Pb = 0 <- no buttons down.
Pb & 1 <- right button down.
Pb & 2 <- middle button down.
Pb & 4 <- left button down.
Pb & 8 <- M4 button down.
row'' andcolumn'' parameters are the coordinates of the
locator position in the xterm window, encoded as ASCII deci-
mal.
The
page'' parameter is not used by xterm, and will be omit-
ted.
`
CSI Ps x Request Terminal Parameters (DECREQTPARM).
if Ps is a "0" (default) or "1", and xterm is emulating VT100,
the control sequence elicits a response of the same form whose
parameters describe the terminal:
Ps -> the given Ps incremented by 2.
Pn = 1 <- no parity.
Pn = 1 <- eight bits.
Pn = 1 <- 2 8 transmit 38.4k baud.
Pn = 1 <- 2 8 receive 38.4k baud.
Pn = 1 <- clock multiplier.
Pn = 0 <- STP flags.
CSI Pm l Reset Mode (RM).
Ps = 2 -> Keyboard Action Mode (AM).
Ps = 4 -> Replace Mode (IRM).
Ps = 1 2 -> Send/receive (SRM).
Ps = 2 0 -> Normal Linefeed (LNM).
CSI ? Pm l
DEC Private Mode Reset (DECRST).
Ps = 1 -> Normal Cursor Keys (DECCKM).
Ps = 2 -> Designate VT52 mode (DECANM).
Ps = 3 -> 80 Column Mode (DECCOLM).
Ps = 4 -> Jump (Fast) Scroll (DECSCLM).
Ps = 5 -> Normal Video (DECSCNM).
Ps = 6 -> Normal Cursor Mode (DECOM).
Ps = 7 -> No Wraparound Mode (DECAWM).
Ps = 8 -> No Auto-repeat Keys (DECARM).
Ps = 9 -> Don't send Mouse X & Y on button press.
Ps = 1 0 -> Hide toolbar (rxvt).
Ps = 1 2 -> Stop Blinking Cursor (att610).
Ps = 1 8 -> Don't print form feed (DECPFF).
Ps = 1 9 -> Limit print to scrolling region (DECPEX).
Ps = 2 5 -> Hide Cursor (DECTCEM).
Ps = 3 0 -> Don't show scrollbar (rxvt).
Ps = 3 5 -> Disable font-shifting functions (rxvt).
Ps = 4 0 -> Disallow 80 -> 132 Mode.
Ps = 4 1 -> No more(1) fix (see curses resource).
Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-
NRCM).
Ps = 4 4 -> Turn Off Margin Bell.
Ps = 4 5 -> No Reverse-wraparound Mode.
Ps = 4 6 -> Stop Logging. (This is normally disabled by a
compile-time option).
Ps = 4 7 -> Use Normal Screen Buffer.
Ps = 6 6 -> Numeric keypad (DECNKM).
Ps = 6 7 -> Backarrow key sends delete (DECBKM).
Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and
release. See the section Mouse Tracking.
Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.
Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.
Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.
Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.
Ps = 1 0 0 5 -> Disable Extended Mouse Mode.
Ps = 1 0 1 0 -> Don't scroll to bottom on tty output
(rxvt).
Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).
Ps = 1 0 3 4 -> Don't interpret "meta" key. (This disables
the eightBitInput resource).
Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-
Lock keys. (This disables the numLock resource).
Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.
(This disables the metaSendsEscape resource).
Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad
Delete key.
Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.
(This disables the altSendsEscape resource).
Ps = 1 0 4 0 -> Do not keep selection when not highlighted.
(This disables the keepSelection resource).
Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables
the selectToClipboard resource).
Ps = 1 0 4 2 -> Disable Urgency window manager hint when
Control-G is received. (This disables the bellIsUrgent
resource).
Ps = 1 0 4 3 -> Disable raising of the window when Control-
G is received. (This disables the popOnBell resource).
Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen
first if in the Alternate Screen. (This may be disabled by
the titeInhibit resource).
Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be
disabled by the titeInhibit resource).
Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor
as in DECRC. (This may be disabled by the titeInhibit
resource). This combines the effects of the 1 0 4 7 and 1 0
4 8 modes. Use this with terminfo-based applications rather
than the 4 7 mode.
Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.
Ps = 1 0 5 1 -> Reset Sun function-key mode.
Ps = 1 0 5 2 -> Reset HP function-key mode.
Ps = 1 0 5 3 -> Reset SCO function-key mode.
Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).
Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.
Ps = 2 0 0 4 -> Reset bracketed paste mode.
CSI > Ps; Ps T
Reset one or more features of the title modes to the default
value. Normally, "reset" disables the feature. It is possi-
ble to disable the ability to reset features by compiling a
different default for the title modes into xterm.
Ps = 0 -> Do not set window/icon labels using hexadecimal.
Ps = 1 -> Do not query window/icon labels using hexadeci-
mal.
Ps = 2 -> Do not set window/icon labels using UTF-8.
Ps = 3 -> Do not query window/icon labels using UTF-8.
(See discussion of "Title Modes").
CSI u
Restore cursor (ANSI.SYS).
CSI ? Pm r
Restore DEC Private Mode Values. The value of Ps previously
saved is restored. Ps values are the same as for DECSET.
CSI s
Save cursor (ANSI.SYS).
Save DEC Private Mode Values. Ps values are the same as for
CSI Ps T Scroll down Ps lines (default = 1) (SD).
CSI Ps S Scroll up Ps lines (default = 1) (SU).
`
CSI Ps x Select Attribute Change Extent (DECSACE).
Ps = 0 -> from start to end position, wrapped.
Ps = 1 -> from start to end position, wrapped.
Ps = 2 -> rectangle (exact).
`
CSI Pt; Pl; Pb; Pr; Ps$ r
Change Attributes in Rectangular Area (DECCARA), VT400 and up.
Pt; Pl; Pb; Pr denotes the rectangle.
Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
NOTE: xterm doesn't enable this code by default.
set the background color and character for the following writings to the output buffer. Example:
program.setBackground('green', 'O')
program.setForeground('red', 'i')
program.on('mouse', function (data) {
program.cup(data.y, data.x);
program.write(' ', 'blue bg');
program.write('as', 'red fg');
program.cup(0, 0);
});
CSI Ps " q
Select character protection attribute (DECSCA). Valid values
for the parameter:
Ps = 0 -> DECSED and DECSEL can erase (default).
Ps = 1 -> DECSED and DECSEL cannot erase.
Ps = 2 -> DECSED and DECSEL can erase.
`
CSI Ps SP q
Set cursor style (DECSCUSR, VT520).
Ps = 0 -> blinking block.
Ps = 1 -> blinking block (default).
Ps = 2 -> steady block.
Ps = 3 -> blinking underline.
Ps = 4 -> steady underline.
`
set the foreground color and character for the following writings to the output buffer. Example:
program.setBackground('green', 'O')
program.setForeground('red', 'i')
program.on('mouse', function (data) {
program.cup(data.y, data.x);
program.write(' ', 'blue bg');
program.write('as', 'red fg');
program.cup(0, 0);
});
`
CSI Pm h Set Mode (SM).
Ps = 2 -> Keyboard Action Mode (AM).
Ps = 4 -> Insert Mode (IRM).
Ps = 1 2 -> Send/receive (SRM).
Ps = 2 0 -> Automatic Newline (LNM).
CSI ? Pm h
DEC Private Mode Set (DECSET).
Ps = 1 -> Application Cursor Keys (DECCKM).
Ps = 2 -> Designate USASCII for character sets G0-G3
(DECANM), and set VT100 mode.
Ps = 3 -> 132 Column Mode (DECCOLM).
Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).
Ps = 5 -> Reverse Video (DECSCNM).
Ps = 6 -> Origin Mode (DECOM).
Ps = 7 -> Wraparound Mode (DECAWM).
Ps = 8 -> Auto-repeat Keys (DECARM).
Ps = 9 -> Send Mouse X & Y on button press. See the sec-
tion Mouse Tracking.
Ps = 1 0 -> Show toolbar (rxvt).
Ps = 1 2 -> Start Blinking Cursor (att610).
Ps = 1 8 -> Print form feed (DECPFF).
Ps = 1 9 -> Set print extent to full screen (DECPEX).
Ps = 2 5 -> Show Cursor (DECTCEM).
Ps = 3 0 -> Show scrollbar (rxvt).
Ps = 3 5 -> Enable font-shifting functions (rxvt).
Ps = 3 8 -> Enter Tektronix Mode (DECTEK).
Ps = 4 0 -> Allow 80 -> 132 Mode.
Ps = 4 1 -> more(1) fix (see curses resource).
Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-
RCM).
Ps = 4 4 -> Turn On Margin Bell.
Ps = 4 5 -> Reverse-wraparound Mode.
Ps = 4 6 -> Start Logging. This is normally disabled by a
compile-time option.
Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-
abled by the titeInhibit resource).
Ps = 6 6 -> Application keypad (DECNKM).
Ps = 6 7 -> Backarrow key sends backspace (DECBKM).
Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
release. See the section Mouse Tracking.
Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.
Ps = 1 0 0 5 -> Enable Extended Mouse Mode.
Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
(enables the eightBitInput resource).
Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-
Lock keys. (This enables the numLock resource).
Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This
enables the metaSendsEscape resource).
Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete
key.
Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This
enables the altSendsEscape resource).
Ps = 1 0 4 0 -> Keep selection even if not highlighted.
(This enables the keepSelection resource).
Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables
the selectToClipboard resource).
Ps = 1 0 4 2 -> Enable Urgency window manager hint when
Control-G is received. (This enables the bellIsUrgent
resource).
Ps = 1 0 4 3 -> Enable raising of the window when Control-G
is received. (enables the popOnBell resource).
Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be
disabled by the titeInhibit resource).
Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-
abled by the titeInhibit resource).
Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate
Screen Buffer, clearing it first. (This may be disabled by
the titeInhibit resource). This combines the effects of the 1
0 4 7 and 1 0 4 8 modes. Use this with terminfo-based
applications rather than the 4 7 mode.
Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.
Ps = 1 0 5 1 -> Set Sun function-key mode.
Ps = 1 0 5 2 -> Set HP function-key mode.
Ps = 1 0 5 3 -> Set SCO function-key mode.
Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).
Ps = 1 0 6 1 -> Set VT220 keyboard emulation.
Ps = 2 0 0 4 -> Set bracketed paste mode.
Modes:
http://vt100.net/docs/vt220-rm/chapter4.html
`
Example: Show cursor:
return this.setMode('?25', (error, data)=>{
});
`
CSI > Ps p
Set resource value pointerMode. This is used by xterm to
decide whether to hide the pointer cursor as the user types.
Valid values for the parameter:
Ps = 0 -> never hide the pointer.
Ps = 1 -> hide if the mouse tracking mode is not enabled.
Ps = 2 -> always hide the pointer. If no parameter is
given, xterm uses the default, which is 1 .
`
CSI Ps ; Ps r
Set Scrolling Region [top;bottom] (default = full size of win-
dow) (DECSTBM).
CSI ? Pm r
CSI > Ps; Ps t
Set one or more features of the title modes. Each parameter
enables a single feature.
Ps = 0 -> Set window/icon labels using hexadecimal.
Ps = 1 -> Query window/icon labels using hexadecimal.
Ps = 2 -> Set window/icon labels using UTF-8.
Ps = 3 -> Query window/icon labels using UTF-8. (See dis-
cussion of "Title Modes")
XXX VTE bizarelly echos this:
sets cursor
Uses setMode 2 5 to show the cursor: NOTE: In xterm terminfo: cnorm stops blinking cursor cvvis starts blinking cursor
Queries whether the terminal of the type is
.
Writes to this.output
Example: program.write('Hello world', 'blue fg')
Generated using TypeDoc
The Program instance manages the low level interaction the the terminal. It emit the basi native events to the screens. It has associated an output writable stream attribute which ussually is stdout but could could be conigured by the user using IBlessedProgramOptions. The same for an input Readable stream from which the host terminal respond to the program requests.
The communication with the host system is mostly done writing
tput
sequences to the output stream. The program is responsible of portability and supporting the same API thgouth several terminal standards / vendorsAlthough the BlessedProgram instances are not Nodes (unlike Screens that are) they have a somwhat similar API, emiting events with similar names and has some simlar attributes, but it's important to known that most of these events and attributes refer to the host terminal window and not with the lines inside the screen. For example, focus or blur event refers to the terminal window focus, not the internal Blessed Element
In general users don't have to use the program for develop their applications, however, it can be accessed from the screen and its lower level api can be used along the application.
Example 1
Starting a program alone, and register 'q' to exist
const program = blessed.program({ }) program.setMouse({ allMotion: true, }, true); program.alternateBuffer() program.enableMouse() program.key(['q', 'escape', 'C-c'], function () { program.showCursor() program.disableMouse() program.normalBuffer() process.exit(0) })
Example 2:
Registering for resize, blur, and focus terminal window native events:
program.setMouse({ sendFocus: true }, true) program.on('resize', function (data) { setTimeout(function () { program.clear(); program.cup(0, 0); }, 200); }); process.on('SIGWINCH', function (data) { setTimeout(function () { program.cup(1, 0); }, 200); }); program.on('focus', function (data) { program.clear(); program.cup(0, 0); }); program.on('blur', function (data) { program.clear(); program.cup(0, 0); });
Example 3:
Drawing on mouse move
program.setBackground('green', 'O') program.setForeground('red', 'i') program.on('mouse', function (data) { program.cup(data.y, data.x); program.write(' ', 'blue bg'); program.write('as', 'red fg'); program.cup(0, 0); });
Example 4
Setting the cursor style
program.showCursor(); program.setCursorStyle(1); setTimeout(() => { program.setCursorStyle(2); }, 9000); setTimeout(() => { program.setCursorStyle(4); }, 3000); setTimeout(() => { program.setCursorStyle(3); }, 6000);
Example 5
Minimize / Maximize the terminal window and requesting it size and position and cursor
program.write('MINIMIZING IN 2 seconds') setTimeout(() => { program.manipulateWindow(2, (err, data)=>{ program.log(data); }) }, 2000) setTimeout(() => { program.manipulateWindow(1, (err, data)=>{ program.log(data); }) }, 4000) program.getCursor(function(err, data) { program.write(util.inspect(data)); }); program.getWindowSize(function(err:any, data:any) { program.log('getWindowSize', data); });