Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ref:cterm [2024/02/09 17:40] – update deuceref:cterm [2024/09/25 23:16] (current) – The wiki sucked... link to new asciidoctor generated page. deuce
Line 1: Line 1:
 ====== CTerm ====== ====== CTerm ======
-CTerm is the ANSI parsing code maintained as part of ciolib (and used by SyncTERM).  This page is basically a pretty version of the [[https://gitlab.synchro.net/main/sbbs/-/raw/master/src/conio/cterm.txt?ref_type=heads|cterm.txt file in git]], as of 72305c4cfe7afe31064422694beac53a9fe8e5f3 +CTerm is the ANSI parsing code maintained as part of ciolib (and used by SyncTERM).  The documentation is available at the [[https://syncterm.bbsdev.net/cterm.html|SyncTERM website]].
- +
-The text file is still the normative reference, but this may serve as a friendlier source. +
- +
-===== CTerm terminal characteristics ===== +
- +
-==== End of line behaviour (wrapping) ==== +
- +
-The cursor is moved to the first character of the next line as soon as a character is written to the last column of the current line, not on the next character.  A tab will wrap to the next line only if the current cursor position is the last character on the line.  This behavior is often surprising to people who are used to VT emulators which implement the LCF as documented in STD-070, who expect the cursor to "stick" in the last column until the next character is received. +
- +
-There are two settable flags that will impact the default behaviour. +
- +
-''CSI ? 7 l'' will disable wrapping at the end of line completely, and any characters written to the last column will not move the cursor at all, overwriting the existing charater. Default behaviour can be restored with CSI ? 7 h. +
- +
-If the ''CSI = 4 h'' sequence is received, CTerm will enable LCF mode as documented in STD-070, and ''CSI = 4 l'' will restore default behaviour.  ''CSI = 5 h'' will set LCF mode and disable ''CSI = 4 l'', as well as cause LCF to remain enabled across an ''ESC c'' (RIS). +
- +
-Specifically, the LCF will be set when displaying a printable character advances the cursor to the right margin, and cleared by any of the following being received: +
-''CSI ? 6 h'', ''CSI ? 6 l'', ''CSI ? 7 l'', ''CSI @'', ''CSI A'', ''CSI B'', ''CSI a'', ''CSI j'', ''CSI H'', ''CSI f'', ''CSI I'', ''CSI Y'', ''CSI J'', ''CSI K'', ''CSI P'', ''CSI X'', ''CSI r'', ''ESC E'', ''ESC M'', ''CR'', ''LF'', ''BS'', ''TAB'', Any normal printable character when the cursor is at the right margin (of the screen or scrollable area). +
- +
-===== Control Characters ===== +
- +
-^ Name ^ Hex      ^ Description ^ +
-| NUL  | ''0x00'' | No action is taken unless doorway mode is enabled.  In doorway mode, indicates that the next character is a literal character.  The IBM CP437 character will be displayed.  This allows ESC and other control characters to be placed on the screen. | +
-| BEL  | ''0x07'' | Terminal will beep | +
-| BS   | ''0x08'' | Non-destructive backspace.  Moves cursor position to the previous column unless the current column is the first, in which case no operation is performed. | +
-| HT   | ''0x09'' | Moves to the next horizontal tab stop.  Does not overwrite any characters in between.  If there are no tab stops left in the line, moves to the first position of the next line. If the starting position is on the last line, will perform a scroll, filling the new line at bottom with the current attribute. | +
-| LF  | ''0x0A'' | Move cursor position to same column of the next row. If current row is the last row, scrolls the screen up and fills the new row with the current attribute. | +
-| CR  | ''0x0D'' | Move cursor position to column 1 of the current line | +
-| ESC | ''0x1B'' | Introduces a control code.  The ESC and the next byte together form the control code.  If the control code is not valid, the ESC is ignored. | +
- +
-===== Control Codes ===== +
- +
-Control codes are in the following format: +
-''ESC {'0' (ZERO) to '~'}'' Legal combinations which are not handled are silently dropped. +
- +
-^ Mnemonic ^ Name                        ^ Sequence   ^ Description ^ +
-| NEL      | Next Line                   | ''ESC E''  | Moves to the line home position of the next line. (Same as CR LF) | +
-| HTS      | Set Tab                     | ''ESC H''  | Sets a tab stop at the current column. ECMA-048 | +
-| RI       | Reverse Line Feed           | ''ESC M''  | Move up one line. ECMA-048 | +
-| DCS      | Device Control String       | ''ESC P''  | Begins a string consisting of the characters 0x08 - 0x0d and 0x20-0x7e, terminated by a String Terminator (ST) | +
-| SOS      | Start of String             | ''ESC X''  | As the above strings, but may contain any characters except a Start Of String sequence or a String Terminator sequence. The string is currently ignored. | +
-| CSI      | Control Sequence Introducer | ''ESC [''  |Introduces a control sequence.  If the control valid, but not supported the CSI is ignored.  If the control sequence is //not// valid, it is displayed | +
-| ST       | String Terminator           | ''ESC \''  | Ends a string sequence | +
-| OSC      | Operating System Command    | ''ESC ]''  | Begins a string consisting of the characters 0x08 - 0x0d and 0x20-0x7e, terminated by a String Terminator (ST) | +
-| PM       | Privacy Message             | ''ESC ^''  | Begins a string consisting of the characters 0x08 - 0x0d and 0x20-0x7e, terminated by a String Terminator (ST) The string is currently ignored. | +
-| APS      | Application Program String  | ''ESC _''  | Begins a string consisting of the characters 0x08 - 0x0d and 0x20-0x7e, terminated by a String Terminator (ST) | +
-| RIS      | Reset to Initial State      | ''ESC c''  | Resets all the terminal settings, clears the screen, and homes the cursor. | +
- +
-==== Supported DCS string values ==== +
-=== CTerm loadable font === +
-**Sequence:** ''CTerm:Font:p1:<b64>''\\  +
-Indicates the string is a loadable font. (CTerm 1.213) +
- +
-p1 is a font slot number, which must be higher than the last default defined font (See CSI sp D for list of predefined fonts). <b64> is the base64 encoded font data.  Font size is deduced from the size of the data.  This replaces the now deprecated ''CSI = Ps1 ; Ps2 {'' +
- +
-=== Sixel Sequence === +
-**Sequence:** ''[ p1 [ ; p2 ] ] q''\\  +
-**Defaults:**  p1 = 0  p2 = 0\\  +
-Indicates the string is a sixel sequence. +
- +
-p1 selects the vertical height of a single pixel.  This may be overridden by the raster attributes command, and is deprecated.   +
- +
-Supported values +
-^ Value   ^ Vertical Size ^ +
-| 0,1,5,6 | 2 pixels      | +
-| 2       | 5 pixels      | +
-| 3,4     | 3 pixels      | +
-| 7,8,9   | 1 pixel       | +
- +
-p2 indicates if unset sixels should be set to the current background colour.  If p2 is 1, positions specified as 0 remain at their current colour. +
- +
-Any additional parameters are ignored. +
- +
-The rest of the string is made up of sixel data characters and sixel control functions.  Sixel data characters are in the rage of '?' (0x3f) to '~' (0x7e).  Each sixel data character represents six vertical pixels.  The data is extracted by subtracting 0x3f from the ASCII value of the character. The least significant bit is the topmost pixel. +
- +
-== Sixel Control Functions == +
-^ String                        ^ Name                       ^ Description ^ +
-| ''! Pn X''                    | Graphics Repeat Introducer | The character X is repeated Pn times. | +
-| ''p1 ; p2 [ ; p3 [ ; p4 ] ]'' | Raster Attributes          | p1 indicates the vertical size in pixels of each sixel.\\ p2 indicates the horizontal size in pixels.\\ p3 and p4 define the height and width (in sixels) respectively of a block to fill with the background colour.  This block may not extend past the current bottom of the screen.  If any pixel data characters proceed this command, it is ignored. | +
-| ''# p1''                      | Colour Select              | Selects the current foreground colour from the sixel palette. | +
-| ''# p1 ; p2 ; p3 ; p4 ; p5''  | Palette map                | Defines sixel palette entry p1 and sets it as the current foreground colour.  p2 specifies the colour space to define the colour in, the only supported value is 2.  p3, p4, and p5 specify the red, green, and blue content as a percentage (0-100). | +
-| ''$''                         | Graphics Carriage Return   | Returns the active position to the left border of the same sixel row.  Generally, one pass per colour is used.  In passes after the first one, sixels with a value of zero are not overwritten with the background colour. | +
-| ''-''                         | Graphics New Line          | Moves the active position to the left border of the next sixel row. | +
- +
-=== Request Status String (DECRQSS) === +
-**Sequence:** ''$ q pt''\\  +
-pt is the intermediate and/or final characters of a control function to query the status of.  The terminal will send a response in the format ''DCS p1 $ r pt ST'' +
- +
-p1 is 1 if the terminal supports querying the control function and 0 if it does not. +
- +
-pt is the characters in the control function except the CSI characters. +
- +
-Currently supported values of p1: +
-^ Value  ^ Description ^ +
-| ''m''  | Request SGR parameters | +
-| ''r''  | Request top and bottom margins | +
-| ''s''  | Request left and right margins | +
-| ''t''  | Request height in lines | +
-| ''$|'' | Request width in columns | +
-| ''*|'' | Request height in lines | +
- +
-=== Define Macro (DECDMAC) === +
-**Sequence:** ''p1 [ ; p2 [ ; p3 ] ! z''\\  +
-**Defaults:** p2 = 0  p3 = 0\\  +
-Sets a macro to be replayed using ''CSI Pn * z'' +
- +
-p1 is the macro number to set, and make be between 0 and 63 inclusive. +
- +
-If p2 is zero, the macro numbered p1 will be deleted. If p2 is one, all macros are deleted. +
-  +
-If p3 is zero, the macro is defined using ASCII characters (0x20 - 0x7e and 0xa0 - 0xff only) if p3 is one, the macro is defined using hex pairs. +
- +
-When the macro is defined using hex pairs, a repeat sequence may be included in the format of ''! Pn ; D..D ;''. Pn specifies the number of repeats (default of one instance) D..D is the sequence of pairs to send Pn times.  The terminating ; may be left out if the sequence to be repeated ends at the end of the string. +
- +
-==== Supported OSC string values ==== +
- +
-=== Palette Redefinition === +
-**Sequence:** ''4;(pX;pY)...''\\  +
-Specifies one or more palette redefinitions. pX is the palette index, and pY is the colour definition +
-Color format: ''rgb:R/G/B'' Where R, G, and B are a sequence of one to four hex digits representing the value of the red, green, and blue channels respectively. xterm +
- +
-==== Supported APS string values ==== +
- +
-SyncTERM implements the following APS commands: +
- +
-=== Store File === +
-**Sequence:** ''APS SyncTERM:C;S Ps1 Ps2 ST''\\  +
-Where Ps1 is a filename and Ps2 is the base64 encoded contents of the file.  The named file is stored in the cache directory for the current connection. +
- +
-=== List Files in Cache === +
-**Sequence:** ''APS SyncTERM:C;L Ps ST''\\  +
-List files in cache.  SyncTERM responds with an APS string with lines separated by newlines.  The first line is always "SyncTERM:C;L\n" and for each matching file, a line in the form <Filename> TAB <MD5 sum> LF is sent (ie: "coolfont.fnt\t595f44fec1e92a71d3e9e77456ba80d1\n"+
- +
-And additional argument can be specified as a glob(3) pattern (defaults to "*") in ''APS SyncTERM:C;L;Ps ST''+
- +
-=== Set Font === +
-**Sequence:** ''APS SyncTERM:C;SetFont Pn Ps''\\  +
-Where Pn is a font slot number (max 255) and Ps is a filename in the cache.  This sets font slot Pn to use the specified font file. +
- +
-=== Draw PPM === +
-**Sequence:** ''APS SyncTERM:C;DrawPPM Ps... Ps2''\\  +
-Draws a PPM from the cache directory on the screen. Ps2 is the filename and is required.  Arguments for Ps are optional.  The following options can be included (separated by semi-colons): +
- +
-^ Option               ^ Description ^ +
-| ''SX=#''              Sets the left X position in the specified image to copy from.  Default = 0. | +
-| ''SY=#''             | Sets the top Y position in the specified image to copy from.  Default = 0. | +
-| ''SW=#''             | Sets the width of the portion of the image to copy.  Default = Image width - SX | +
-| ''SH=#''             | Sets the height of the portion of the image to copy.  Default = Image height - SH | +
-| ''DX=#''             | Sets the X position on the screen to draw the image at.  Default = 0. | +
-| ''DY=#''             | Sets the Y position on the screen to draw the image at.  Default = 0. | +
-| ''MX=#''             | Sets the X position in the mask to start applying from.  Default = 0. | +
-| ''MY=#''             | Sets the Y position in the mask to start applying from.  Default = 0. | +
-| ''MW=#''             | Sets the overall width of the mask (not the width to apply).  If MFILE is not specified, and a mask is (ie: using MASK=), this is required.  If MFILE is specified, the width is read from the file. | +
-| ''MH=#''             | Sets the overall height of the mask (not the height to apply).  If MFILE is not specified, and a mask is (ie: using MASK=), this is required.  If MFILE is specified, the width is read from the file. | +
-| ''MFILE=<filename>'' | Specifies a filename in the cache directory of a PBM file specifying a mask of which pixels to copy.  Any pixel set to black (ie: 1) in the PBM will be drawn from the source image.  Pixels set to white (ie: 0) will be left untouched. | +
-| ''MASK=<maskbits>''  | Specifies a base64-encoded bitmap, each set bit will be drawn from the source image, cleared bits will not be drawn.  Requires ''MW='' and ''MH='' to be specified. | +
-| ''MBUF''             | Uses the loaded mask buffer. | +
- +
-The PPM file may be raw (preferred) or text.  SyncTERM does not support more than 255 values per colour channel and assumes it is correctly using the BT.709 gamma transfer. +
- +
-=== Load PPM === +
-**Sequence:** ''APS SyncTERM:C;LoadPPM Ps... Ps0''\\  +
-Loads a PPM to a buffer.  Ps0 is the filename +
-| ''B=#'' | Selects the buffer (0 or 1 only) to paste from. | +
- +
-=== Load PBM === +
-**Sequence:** ''APS SyncTERM:C;LoadPBM Ps... Ps0''\\  +
-Loads a PBM to a buffer.  Ps0 is the filename +
- +
-=== Copy === +
-**Sequence:** ''APS SyncTERM:P;Copy Ps...''\\  +
-Copies a portion of the screen into an internal buffer for use with the Paste function.  Defaults to copying the entire screen. +
-| ''B=#'' | Selects the buffer (0 or 1 only) to copy to. | +
-| ''X=#'' | Sets the left X position on the screen to start copying at.  Default = 0. | +
-| ''Y=#'' | Sets the top Y position on the screen to start copying at.  Default = 0. | +
-| ''W=#'' | Sets the width to copy. Default = Screen width - X. | +
-| ''H=#'' | Sets the height to copy. Default = Screen height - X. | +
- +
-=== Paste === +
-**Sequence:** ''APS SyncTERM:P,Paste Ps...''\\  +
-Pastes from the copied buffer.  Supports the same options as the Cache DrawPPM command except for the filename, and adds the B= option. +
-| ''B=#'' | Selects the buffer (0 or 1 only) to paste from. | +
- +
-===== Control Sequences ===== +
-Control sequences are in the following format: +
-''CSI {'0' (ZERO) to '?'}{SPACE to '/'}{'@' to '~'}'' +
-There may be multiple characters from the {'0' (ZERO) to '?'} and {SPACE to '/'} before the terminating {'@' to '~'} character. +
- +
-Legal combinations not handled are silently dropped. +
-Illegal combinations are displayed. +
- +
-==== Sequence Parameters ==== +
-Parameters are expressed by the {'0' (ZERO) to '?'} character set. Sequences which use parameters use decimal parameters separated by a ';' The use of a ':' from the set is reserved. If the parameter string begins with '<', '=', '>', or '?' then this is a non-standard extension to the ANSI spec. +
-| ''Pn''        | Indicates a single numeric parameter | +
-| ''Pn1 ; Pn2'' | Two numeric parameters | +
-| ''Pn...''     | Any number of numeric parameters | +
-| ''Ps''        | Single selective parameter | +
-| ''Ps1 ; Ps1'' | Two selective parameters | +
-| ''Ps...''     | Any numer of selective parameters | +
- +
-If a default is defined, the parameter is optional +
- +
-==== Insert Character(s) (ICH) ==== +
-**Sequence:** ''CSI Pn @''\\  +
-**Defaults:** Pn = 1\\  +
-Moves text from the current position to the right edge ''Pn'' characters to the right, with rightmost characters going off-screen and the resulting hole being filled with the current attribute. ECMA-48 +
- +
-==== Scroll Left (SL) ==== +
-**Sequence:** ''CSI Pn SP @''\\  +
-**Defaults:** Pn = 1\\  +
-Shifts the contents of the screen left Pn columns(s) with leftmost columns going off-screen and the resulting hole being filled with the current attribute. ECMA-48 +
- +
-==== Cursor Up (CUU) ==== +
-**Sequence:** ''CSI Pn A''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position up Pn lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Scroll Right (SR) ==== +
-**Sequence:** ''CSI Pn SP A''\\  +
-**Defaults:** Pn = 1\\  +
-Shifts the contents of the screen right Pn columns(s) with rightmost columns going off-screen and the resulting hole being filled with the current attribute. ECMA-48 +
- +
-==== Cursor Down (CUD) ==== +
-**Sequence:** ''CSI Pn B''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position down Pn lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Cursor Right (CUF) ==== +
-**Sequence:** ''CSI Pn C''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position right Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Cursor Left (CUB) ==== +
-**Sequence:** ''CSI Pn D''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position left Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Font Selection (FNT) ==== +
-**Sequence:** ''CSI Ps1 ; Ps2 SP D''\\  +
-**Defaults:** Ps1 = 0, Ps2 = 0\\  +
-Sets font Ps1 to be the one indicated by Ps2.  Currently four fonts are supported.  Ps2 must be between 0 and 255.  Not all output types support font selection.  Only X11 and SDL currently do. +
- +
-Supported Ps1 values: +
-| 0 | Default font | +
-| 1 | Font selected by the high intensity bit when ''CSI ? 31 h'' is enabled | +
-| 2 | Font selected by the blink intensity bit when ''CSI ? 34 h'' is enabled | +
-| 3 | Font selected by both the high intensity and blink bits when both CSI ? 31 h and CSI ? 34 h are enabled| +
- +
-Currently included fonts are: +
-| 0  | Codepage 437 English | +
-| 1  | Codepage 1251 Cyrillic, (swiss) | +
-| 2  | Russian koi8-r | +
-| 3  | ISO-8859-2 Central European | +
-| 4  | ISO-8859-4 Baltic wide (VGA 9bit mapped) | +
-| 5  | Codepage 866 (c) Russian | +
-| 6  | ISO-8859-9 Turkish | +
-| 7  | haik8 codepage (use only with armscii8 screenmap) | +
-| 8  | ISO-8859-8 Hebrew | +
-| 9  | Ukrainian font koi8-u | +
-| 10 | ISO-8859-15 West European, (thin) | +
-| 11 | ISO-8859-4 Baltic (VGA 9bit mapped) | +
-| 12 | Russian koi8-r (b) | +
-| 13 | ISO-8859-4 Baltic wide | +
-| 14 | ISO-8859-5 Cyrillic | +
-| 15 | ARMSCII-8 Character set | +
-| 16 | ISO-8859-15 West European | +
-| 17 | Codepage 850 Multilingual Latin I, (thin) | +
-| 18 | Codepage 850 Multilingual Latin I | +
-| 19 | Codepage 885 Norwegian, (thin) | +
-| 20 | Codepage 1251 Cyrillic | +
-| 21 | ISO-8859-7 Greek | +
-| 22 | Russian koi8-r (c) | +
-| 23 | ISO-8859-4 Baltic | +
-| 24 | ISO-8859-1 West European | +
-| 25 | Codepage 866 Russian | +
-| 26 | Codepage 437 English, (thin) | +
-| 27 | Codepage 866 (b) Russian | +
-| 28 | Codepage 885 Norwegian | +
-| 29 | Ukrainian font cp866u | +
-| 30 | ISO-8859-1 West European, (thin) | +
-| 31 | Codepage 1131 Belarusian, (swiss) | +
-| 32 | Commodore 64 (UPPER) | +
-| 33 | Commodore 64 (Lower) | +
-| 34 | Commodore 128 (UPPER) | +
-| 35 | Commodore 128 (Lower) | +
-| 36 | Atari | +
-| 37 | P0T NOoDLE (Amiga) | +
-| 38 | mO'sOul (Amiga) | +
-| 39 | MicroKnight Plus (Amiga) | +
-| 40 | Topaz Plus (Amiga) | +
-| 41 | MicroKnight (Amiga) | +
-| 42 | Topaz (Amiga) | +
- +
-Not all fonts are supported in all modes.  If a font is not supported in the current mode, no action is taken, but there should be a non-zero 'Font Selection result' value in the Font State Report. ECMA-48 +
- +
-==== Cursor Next Line (CNL) ==== +
-**Sequence:** ''CSI Pn E''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor to the first column of the line Pn down from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Cursor Preceding Line (CPL) ==== +
-**Sequence:** ''CSI Pn F''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor to the first column of the row Pn up from the current position.  Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Cursor Character Absolute (CHA) ==== +
-**Sequence:** ''CSI Pn G''\\  +
-**Defaults:** Pn = 1\\  +
-Movies the cursor to column Pn of the current row. ECMA-48 +
- +
-==== Cursor Position (CUP) ==== +
-**Sequence:** ''CSI Pn1 ; Pn2 H''\\  +
-**Defaults:** Pn = 1, Pn2 = 1\\  +
-Moves the cursor to the Pn2th column of the Pn1th line. ECMA-48 +
- +
-==== Cursor Forward Tabulation (CHT) ==== +
-**Sequence:** ''CSI Pn I''\\  +
-**Defaults:** Pn = 1\\  +
-Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times. ECMA-48 +
- +
-==== Erase in Page (ED) ==== +
-**Sequence:** ''CSI Ps J''\\  +
-**Defaults:** Ps = 0\\  +
-Erases from the current screen according to the value of Ps +
-| 0 | Erase from the current position to the end of the screen. | +
-| 1 | Erase from the current position to the start of the screen. | +
-| 2 | Erase entire screen.  As a violation of ECMA-48, also moves the cursor to position 1/1 as a number of BBS programs assume this  behaviour. | +
-Erased characters are set to the current attribute. ECMA-48 +
- +
-==== Erase in Line (EL) ==== +
-**Sequence:** ''CSI Ps K''\\  +
-**Defaults:** Ps = 0\\  +
-Erases from the current line according to the value pf Ps +
-| 0 | Erase from the current position to the end of the line. | +
-| 1 | Erase from the current position to the start of the line. | +
-| 2 | Erase entire line.| +
-Erased characters are set to the current attribute. +
- +
-==== Insert Line(s) (IL) ==== +
-**Sequence:** ''CSI Pn L''\\  +
-**Defaults:** Pn = 1\\  +
-Inserts Pn lines at the current line position.  The current line and those after it are scrolled down and the new empty lines are filled with the current attribute.  If the cursor is not currently inside the scrolling margins, has no effect. ECMA-48 +
- +
-==== Delete Line(s) / "ANSI Music" (DL) ==== +
-**Sequence:** ''CSI Pn M''\\  +
-**Defaults:** Pn = 1\\  +
-Deletes the current line and the Pn - 1 lines after it scrolling the first non-deleted line up to the current line and filling the newly empty lines at the end of the screen with the current attribute. If the cursor is not currently inside the scrolling margins, has no effect. If "ANSI" Music is fully enabled (''CSI = 2 M''), performs "ANSI" music instead. See "ANSI" MUSIC section for more details. ECMA-48, BANSI +
- +
-==== CTerm Set ANSI Music (CTSAM) ==== +
-**Sequence:** ''CSI = Ps M''\\  +
-**Defaults:** Ps = 0\\  +
-Sets the current state of ANSI music parsing. +
-| 0 | Only ''CSI |'' will introduce an ANSI music string. | +
-| 1 | Both ''CSI |'' and ''CSI N'' will introduce an ANSI music string. | +
-| 2 | ''CSI |'', ''CSI N'', and ''CSI M'' will all introduce an ANSI music string. In this mode, Delete Line will not be available. | +
- +
-==== BananaCom ANSI Music (BCAM) ==== +
-**Sequence:** ''CSI N''\\  +
-If "ANSI" Music is set to BananaCom (''CSI = 1 M'') or fully enabled (''CSI = 2 M'') performs "ANSI" music.  See "ANSI" MUSIC section for more details. BANSI +
- +
-==== Delete Character (DCH) ==== +
-**Sequence:** ''CSI Ps P''\\  +
-**Defaults:** Pn = 1\\  +
-Deletes the character at the current position by shifting all characters from the current column + p1 left to the current column. Opened blanks at the end of the line are filled with the current attribute.  If the cursor is not currently inside the scrolling margins, has no effect. ECMA-48 +
- +
-==== Scroll Up (SU) ==== +
-**Sequence:** ''CSI Ps S''\\  +
-**Defaults:** Pn = 1\\  +
-Scrolls the screen up Pn lines.  New lines emptied at the bottom are filled with the current attribute. ECMA-48 +
- +
-==== XTerm Set or Request Graphics Attribute (XTSRGA) ==== +
-**Sequence:** ''CSI ? Ps1 ; Ps2 S''\\  +
-**Defaults:** None\\  +
-If Ps1 is 2, and Ps2 is 1, replies with the graphics screen information in the following format: ''CSI ? 2 ; 0 ; Px ; Py S'' Where Px is the width of the screen in pixels and Py is the height. XTERM +
- +
-==== Scroll Down (SD) ==== +
-**Sequence:** ''CSI Pn T''\\  +
-**Defaults:** Pn = 1\\  +
-Scrolls all text on the screen down Pn lines.  New lines emptied at the top are filled with the current attribute. ECMA-48 +
- +
-==== Erase Character (ECH) ==== +
-**Sequence:** ''CSI Pn X''\\  +
-**Defaults:** Pn = 1\\  +
-Erase p1 characters starting at the current character.  Will not erase past the end of line. Erased characters are set to the current attribute. This can erase across scroll margins. ECMA-48 +
- +
-==== Cursor Line Tabulation (CVT) ==== +
-**Sequence:** ''CSI Pn Y''\\  +
-**Defaults:** Pn = 1\\  +
-Move the cursor to the Pn-th next tab stop. Basically the same as sending TAB Pn times. ECMA-48 +
- +
-==== Cursor Backward Tabulation (CBT) ==== +
-**Sequence:** ''CSI Pn Z''\\  +
-**Defaults:** Pn = 1\\  +
-Move the cursor to the p1th preceding tab stop.  Will not go past the start of the line. ECMA-48 +
- +
-==== Character Position Absolute (HPA) ==== +
-**Sequence:** ''CSI Pn `''\\  +
-**Defaults:** Pn = 1\\  +
-Move the cursor to the specified position on the current row. Will not go past the end of the line. ECMA-48 +
- +
-==== Cursor Position Forward (HPR) ==== +
-**Sequence:** ''CSI Pn a''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position forward Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Repeat (REP) ==== +
-**Sequence:** ''CSI Pn b''\\  +
-**Defaults:** Pn = 1\\  +
-Repeats the previous graphic character Pn times.  Will not repeat escape sequences. ECMA-48 +
- +
-==== Device Attributes (DA) ==== +
-**Sequence:** ''CSI Ps c''\\  +
-**Defaults:** Ps = 0\\  +
-If Ps is 0, CTerm will reply with the sequence: ''CSI = 67;84;101;114;109;pN c''. ''67;84;101;114;109'' is the ASCII values of the "CTerm" string.  pN is the revision ID of CTerm with dots converted to semi-colons (e.g. "1;156").  Use the revision to detect if a specific feature is available.  If you are adding features to a forked version of cterm, please do so by adding an extra parameter to the end, not by incrementing any existing one! ECMA-48 +
- +
-==== CTerm Device Attributes (CTDA) ==== +
-**Sequence:** ''CSI < Ps c''\\  +
-**Defaults:** Ps = 0\\  +
-If Pn is 0, CTerm will reply with the sequence: ''CSI < 0 ; Ps... c'' +
- +
-Possible values for Ps: +
-| 1 | Loadable fonts are availabe via Device Control Strings | +
-| 2 | Bright Background (ie: DECSET 32) is supported | +
-| 3 | Palette entries may be modified via an Operating System Command string | +
-| 4 | Pixel operations are supported (currently, sixel and PPM graphics) | +
-| 5 | The current font may be selected via ''CSI Ps1 ; Ps2 SP D''+
-| 6 | Extended palette is available | +
-| 7 | Mouse is available | +
- +
-==== Line Position Absolute (VPA) ==== +
-**Sequence:** ''CSI Pn d''\\  +
-**Defaults:** Ps = 1\\  +
-Moves to row specified by Pn. ECMA-48 +
- +
-==== Tab Stop Remove (TSR) ==== +
-**Sequence:** ''CSI Pn SP d''\\  +
-**Defaults:** None\\  +
-Removes a tab stop at postion Pn. ECMA-48 +
- +
-==== Line Position Forward (VPR) ==== +
-**Sequence:** ''CSI Pn e''\\  +
-**Defaults:** Pn = 1\\  +
-Moves forward Pn rows. ECMA-48 +
- +
-==== Character and Line Position (HVP) ==== +
-**Sequence:** ''CSI Pn1 ; Pn2 f''\\  +
-**Defaults:** Pn1 = 1, Pn2 = 1\\  +
-Moves the cursor to the Pn2th column of the Pn1th line. ECMA-48 +
- +
-==== Tabulation Clear (TBC) ==== +
-**Sequence:** ''CSI Ps g''\\  +
-**Defaults:** Ps = 0\\  +
-Deletes tab stops according to the values of Ps: +
-| 0 | Deletes tab stop at current position. | +
-| 3 | Deletes all tab stops. | +
-| 5 | Deletes all tab stops. | +
-ECMA-48 +
- +
-==== Enable DoorWay Mode (BCST) / CTerm Set (CTSET) ==== +
-**Sequence:** ''CSI = Ps... h''\\  +
-**Defaults:** None\\  +
-Sets the mode specified by Ps +
-| 4   | Enable Last Column Flag mode (CTELCF) | +
-| 5   | Enabled Forced Last Column Flag mode (CTFLCF) | +
-| 255 | Enable DoorWay Mode (BDRWY) | +
- +
-==== DEC Private Mode Set (DECSET) ==== +
-**Sequence:** ''CSI ? Ps... h''\\  +
-**Defaults:** None\\  +
-Sets one or more mode.  The following modes are supported: +
-^ Value      ^ Mnemonic ^ Default ^ Description ^ +
-| 6          | DECOM    | reset | Enable origin mode. In this mode, position parameters are relative to the top left of the scrolling region, not the screen. | +
-| 7          | DECAWM   | set   | Enable auto wrap. This is the normal mode in which a write to the last column of a row will move the cursor to the start of the next line triggering a scroll if required to create a new line. | +
-| 9          |          | reset | X10 compatible mouse reporting. Mouse button presses will send a ''CSI M <button> <x> <y>'' Where <button> is ' ' + button number (0-based) <x> and <y> are '!' + position (0-based) | +
-| 25         | DECTCEM  | set   | Display the cursor. | +
-| 31                  | reset | Enable bright alt character set. With this mode set, the bright (1) graphic rendition selects characters from an alternate character set. | +
-| 32                  | reset | Bright Intensity Disable. This makes the bright intensity bit not control the intensity. Mostly for use with ''CSI ? 31 h'' to permit fonts in the same colours. | +
-| 33                  | reset | Blink to Bright Intensity Background. With this mode set, the blink (5,6) graphic renditions cause the background colour to be high intensity rather than causing blink. | +
-| 34                  | reset | Enable blink alt character set. With this mode set, the blink (5, 6) graphic renditions selects characters from an alternate character set. | +
-| 35                  | reset | Blink Disabled.  This makes the blink (5, 6) graphic renditions not cause the character to blink.  Mostly for use with ''CSI ? 34 h'' to permit fonts to be used without blinking. +
-| 69                  | reset | DEC Left Right Margin Mode enabled.  Enables CSI s to set the left/right margins, and disables CSI s from saving the current cursor position. | +
-| 80                  | set   | Sixel Scrolling Enabled. When this is set, the sixel active position begins in the upper-left corner of the currently active text position. When the sixel active position reaches the bottom of the page, the page is scrolled up.  At the end of the sixel string, a sixel newline is appended, and the current cursor position is the one in which the bottom sixel is in. | +
-| 1000                | reset | Normal tracking mode mouse reporting. Mouse button presses will send a ''CSI M <button> <x> <y>''. Where <button> is ' ' + button number (0-based). Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) | +
-| 1002                | reset | Button-event tracking mode mouse reporting. Mouse button presses and movement when a button is pressed will send a ''CSI M <button> <x> <y>'', Where <button> is ' ' + button number (0-based). 32 is added to the button number for movement events. Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) | +
-| 1003                | reset | Any-event tracking mode mouse reporting Mouse button presses and movement will send a ''CSI M <button> <x> <y>''. Where <button> is ' ' + button number (0-based) 32 is added to the button number for movement events. Mouse button releases will use a button number of 4 <x> and <y> are '!' + position (0-based) If no button is pressed, it acts as though button 0 is. | +
-| 1006                | reset | SGR encoded extended coordinates. Instead of the CSI M method, the format of mouse reporting is changed to ''CSI < Pb ; Px ; Py M'' for presses and ''CSI < Pb ; Px ; Py m'' for releases. Instead of ''CSI M'' Px and Py are one-based. Pb remains the same (32 added for movement). Button 3 is not used for release (separate code). | +
-| 2004                | reset | Set bracketed paste mode. CTerm does not directly do anything with this, but terminals such as SyncTERM will send ''CSI 200 ~'' before pasted text, and ''CSI 201 ~'' after it. | +
- +
-==== Character Position Backward (HPB) ==== +
-**Sequence:** ''CSI Pn j''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position left Pn columns from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. ECMA-48 +
- +
-==== Line Position Backward (VPB) ==== +
-**Sequence:** ''CSI Pn k''\\  +
-**Defaults:** Pn = 1\\  +
-Moves the cursor position up Pn lines from the current position. Attempting to move past the screen boundaries stops the cursor at the screen boundary. +
- +
-==== Disable DoorWay Mode (BCRST) / CTerm Set (CTRSET) ==== +
-**Sequence:** ''CSI = Ps... l''\\  +
-**Defaults:** None\\  +
-Resets the mode specified by Ps +
-| 4   | Disable Last Column Flag mode (CTDLCF) | +
-| 255 | Disable DoorWay Mode (BDDRWY) | +
- +
-==== DEC Private Mode Reset (DECRST) ==== +
-**Sequence:** ''CSI ? Ps... l''\\  +
-**Defaults:** None\\  +
-Resets one or more mode.  The following modes are supported: +
-^ Value      ^ Mnemonic ^ Default ^ Description ^ +
-| 6          | DECOM    | reset   | Origin Mode. With this mode reset, position parameters are relative to the top left of the screen, not the scrolling region. | +
-| 7          | DECAWM   | set     | Disable auto wrap. Resetting this mode causes a write to the last column of a to leave the cursor where it was before the write occurred, overwriting anything which was previously written to the same position. | +
-| 9          |          | reset   | Disable X10 compatible mouse reporting. | +
-| 25                  | reset   | Hide the cursor. | +
-| 31                  | reset   | Disable bright alt character set. With this mode reset, the bright (1) graphic rendition does not select an alternative font. | +
-| 32                  | reset   | Bright Intensity Enable. When reset, bright intensity graphics rendition behaves normally. | +
-| 33                  | reset   | Disable Blink to Bright Intensity Background. With this mode set, the blink (5,6) graphic renditions do not affect the background colour. | +
-| 34                  | reset   |Disable blink alt character set. With this mode reset, the blink (5, 6) graphic renditions do not select characters from an alternate character set. | +
-| 35                  | reset   | Blink Enable. With this mode reset, the blink (5,6) graphic renditions behave normally (cause the characters to blink). | +
-| 69                  | reset   | DEC Left Right Margin Mode disabled. Disables CSI s from setting the left/right margins, and changes it back to saving the current cursor position.  The current left/right margins are maintained. | +
-| 80                  | set     | Sixel Scrolling Disabled. When this is reset, the sixel active position begins in the upper-left corner of the page.  Any commands that attempt to advance the sixel position past the bottom of the page are ignored.  At the end of the sixel string, the current cursor position is unchanged from where it was when the sixel string started. | +
-| 1000                | reset   | Disable Normal tracking mode mouse reporting | +
-| 1001                | reset   | Disable Highlight tracking mode mouse reporting | +
-| 1002                | reset   | Disable Button-event tracking mode mouse reporting | +
-| 1003                | reset   | Disable Any-event tracking mode mouse reporting | +
-| 1004                | reset   | Disable Focus-event tracking mode mouse reporting | +
-| 1005                | reset   | Disable UTF-8 encoded extended coordinates | +
-| 1006                | reset   | Disable SGR encoded extended coordinates | +
-| 1007                | reset   | Disable Alternate scroll mode | +
-| 1015                | reset   | Disable URXVT encoded extended coordinates | +
-| 2004                | reset   | Disable bracketed paste mode | +
- +
  
 ===== See Also ===== ===== See Also =====
   * [[:ref:ansi:|ANSI References]]   * [[:ref:ansi:|ANSI References]]
 +  * [[https://ecma-international.org/publications-and-standards/standards/ecma-48/|ECMA-48 Standard]]
 +  * [[https://www.invisible-island.net/xterm/ctlseqs/ctlseqs.html|XTerm Control Sequences]]
 +  * [[https://vt100.net/|VT100.net]]
 +  * [[https://raw.githubusercontent.com/dse/vt/master/banana_ansi_bbs.txt|Banana ANSI]]
  
 {{tag>}} {{tag>}}