Examples
CSI 2 J
— This clears the screen and, on some devices, locates the cursor to the y,x position 1,1 (upper left corner).
CSI 32 m
— This makes text green. On MS-DOS, normally the green would be dark, dull green, so you may wish to enable Bold with the sequence CSI 1 m
which would make it bright green, or combined as CSI 32 ; 1 m
. MS-DOS ANSI.SYS uses the Bold state to make the character Bright; also the Blink state can be set (via INT 10, AX 1003h, BL 00h
) to render the Background in the Bright mode. MS-DOS ANSI.SYS does not support SGR codes 90–97 and 100–107 directly.
CSI 0 ; 6 8 ; "DIR" ; 13 p
— This re-assigns the key F10 to send to the keyboard buffer the string "DIR" and ENTER, which in the DOS command line would display the contents of the current directory. (MS-DOS ANSI.SYS only) This is a private-use code (as indicated by the letter p), using a non-standard extension to include a string-valued parameter. Following the letter of the standard would consider the sequence to end at the letter D.
CSI s
— This saves the cursor position. Using the sequence CSI u
will restore it to the position. Say the current cursor position is 7(y) and 10(x). The sequence CSI s
will save those two numbers. Now you can move to a different cursor position, such as 20(y) and 3(x), using the sequence CSI 20 ; 3 H
or CSI 20 ; 3 f
. Now if you use the sequence CSI u the cursor position will return to 7(y) and 10(x). Some terminals require the DEC sequences ESC 7
/ ESC 8
instead which is more widely supported.
Read more about this topic: ANSI Escape Code
Famous quotes containing the word examples:
“No rules exist, and examples are simply life-savers answering the appeals of rules making vain attempts to exist.”
—André Breton (18961966)
“Histories are more full of examples of the fidelity of dogs than of friends.”
—Alexander Pope (16881744)
“There are many examples of women that have excelled in learning, and even in war, but this is no reason we should bring em all up to Latin and Greek or else military discipline, instead of needle-work and housewifry.”
—Bernard Mandeville (16701733)