Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ANSI escape sequence save/restore cursor position support

Are there any known terminals which support the ANSI escape sequences for cursor keys up, down, forward and back:

CSI n A     Cursor Up
CSI n B     Cursor Down
CSI n C     Cursor Forward
CSI n D     Cursor Back

but don't support the save-cursor-position and restore-cursor-position escape sequences?

CSI s       Save Cursor Position
CSI u       Restore Cursor Position
like image 743
sid_com Avatar asked Mar 11 '15 12:03

sid_com


People also ask

Which of the following escape sequence moves the cursor position to the new line?

Escape sequence is used to escape from the normal representation of the string. It is a combination of \ (Backslash) and some character. As an example, \n is used to move cursor to the new line and \r is used to move the cursor to the beginning of the current line.

What are ANSI Colours?

Background Colors Background Black: \u001b[40m. Background Red: \u001b[41m. Background Green: \u001b[42m. Background Yellow: \u001b[43m.

What is ANSI in terminal?

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text.


1 Answers

A genuine VT100 (or VT220 for that matter) did not recognize these control sequences for save/restore cursor position. They use (as noted in xterm's control sequences list)

ESC 7     Save Cursor (DECSC).
ESC 8     Restore Cursor (DECRC).

Those are the sc and rc capabilities in terminfo; you may see these listed using

infocmp vt100
infocmp vt220

The origin of CSI s and CSI u likely is from ansi.sys (see terminal database entry for ansi.sys-old), though an older source is always possible.

like image 133
Thomas Dickey Avatar answered Nov 03 '22 00:11

Thomas Dickey