"Fossies" - the Fresh Open Source Software Archive

Member "xterm-351/ctlseqs.txt" (2 Nov 2019, 124823 Bytes) of package /linux/misc/xterm-351.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "ctlseqs.txt": 349_vs_350.

    1 
    2 
    3 
    4 
    5 
    6 
    7 
    8 
    9 
   10                         XTerm Control Sequences
   11 
   12 
   13                                Edward Moy
   14                    University of California, Berkeley
   15 
   16                                Revised by
   17 
   18                              Stephen Gildea
   19                           X Consortium (1994)
   20 
   21                              Thomas Dickey
   22                       XFree86 Project (1996-2006)
   23                     invisible-island.net (2006-2019)
   24                updated for XTerm Patch #350 (2019/11/02)
   25 
   26 
   27 
   28 
   29 Definitions
   30 
   31 Many controls use parameters, shown in italics.  If a control uses a
   32 single parameter, only one parameter name is listed.  Some parameters
   33 (along with separating ;  characters) may be optional.  Other characters
   34 in the control are required.
   35 
   36 C    A single (required) character.
   37 
   38 Ps   A single (usually optional) numeric parameter, composed of one or
   39      more digits.
   40 
   41 Pm   Any number of single numeric parameters, separated by ;  charac-
   42      ter(s).  Individual values for the parameters are listed with Ps .
   43 
   44 Pt   A text parameter composed of printable characters.
   45 
   46 
   47 Control Bytes, Characters, and Sequences
   48 
   49 ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes.
   50 Those are respectively codes 128 to 159 and 0 to 31.  ECMA-48 avoids
   51 referring to these codes as characters, because that term is associated
   52 with graphic characters.  Instead, it uses "bytes" and "codes", with
   53 occasional lapses to "characters" where the meaning cannot be mistaken.
   54 
   55 Controls (including the escape code 27) are processed once:
   56 
   57 o   This means that a C1 control can be mistaken for badly-formed UTF-8
   58     when the terminal runs in UTF-8 mode because C1 controls are valid
   59     continuation bytes of a UTF-8 encoded (multibyte) value.
   60 
   61 o   It is not possible to use a C1 control obtained from decoding the
   62     UTF-8 text, because that would require reprocessing the data.  Con-
   63     sequently there is no ambiguity in the way this document uses the
   64     term "character" to refer to bytes in a control sequence.
   65 
   66 The order of processing is a necessary consequence of the way ECMA-48 is
   67 designed:
   68 
   69 o   Each byte sent to the terminal can be unambiguously determined to
   70     fall into one of a few categories (C0, C1 and graphic characters).
   71 
   72 o   ECMA-48 is modal; once it starts processing a control sequence, the
   73     terminal continues until the sequence is complete, or some byte is
   74     found which is not allowed in the sequence.
   75 
   76 o   Intermediate, parameter and final bytes may use the same codes as
   77     graphic characters, but they are processed as part of a control
   78     sequence and are not actually graphic characters.
   79 
   80 o   Eight-bit controls can have intermediate, etc., bytes in the range
   81     160 to 255.  Those can be treated as their counterparts in the range
   82     32 to 127.
   83 
   84 o   Single-byte controls can be handled separately from multi-byte con-
   85     trol sequences because ECMA-48's rules are unambiguous.
   86 
   87     As a special case, ECMA-48 (section 9) mentions that the control
   88     functions shift-in and shift-out are allowed to occur within a 7-bit
   89     multibyte control sequence because those cannot alter the meaning of
   90     the control sequence.
   91 
   92 o   Some controls (such as OSC ) introduce a string mode, which is ended
   93     on a ST  (string terminator).
   94 
   95     ECMA-48 describes only correct behavior, telling what types of char-
   96     acters are expected at each stage of the control sequences.  It says
   97     that the action taken in error recovery is implementation-dependent.
   98     XTerm decodes control sequences using a state machine.  It handles
   99     errors in decoding i.e., unexpected characters, by resetting to the
  100     initial (ground) state.  That is different from the treatment of
  101     unimplemented (but correctly formatted) features.
  102 
  103     If an application does not send the string terminator, that is also
  104     an error from the standpoint of a user.  To accommodate users of
  105     those applications, xterm has resource settings which allow work-
  106     arounds:
  107 
  108     o   The Linux console's palette sequences do not use a string termi-
  109         nator.  The brokenLinuxOSC resource setting tells xterm to
  110         ignore those particular sequences.
  111 
  112     o   The terminal should accept single-byte controls within the
  113         string.  But some applications omit a string terminator, like
  114         the Linux console.  The brokenStringTerm resource setting tells
  115         xterm to exit string mode if it decodes a common control charac-
  116         ter such as carriage return before the string terminator.
  117 
  118 
  119 C1 (8-Bit) Control Characters
  120 
  121 The xterm program recognizes both 8-bit and 7-bit control characters.
  122 It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
  123 The following pairs of 7-bit and 8-bit control characters are equiva-
  124 lent:
  125 
  126 ESC D
  127      Index (IND  is 0x84).
  128 
  129 ESC E
  130      Next Line (NEL  is 0x85).
  131 
  132 ESC H
  133      Tab Set (HTS  is 0x88).
  134 
  135 ESC M
  136      Reverse Index (RI  is 0x8d).
  137 
  138 ESC N
  139      Single Shift Select of G2 Character Set (SS2  is 0x8e), VT220.
  140      This affects next character only.
  141 
  142 ESC O
  143      Single Shift Select of G3 Character Set (SS3  is 0x8f), VT220.
  144      This affects next character only.
  145 
  146 ESC P
  147      Device Control String (DCS  is 0x90).
  148 
  149 ESC V
  150      Start of Guarded Area (SPA  is 0x96).
  151 
  152 ESC W
  153      End of Guarded Area (EPA  is 0x97).
  154 
  155 ESC X
  156      Start of String (SOS  is 0x98).
  157 
  158 ESC Z
  159      Return Terminal ID (DECID is 0x9a).  Obsolete form of CSI c  (DA).
  160 
  161 ESC [
  162      Control Sequence Introducer (CSI  is 0x9b).
  163 
  164 ESC \
  165      String Terminator (ST  is 0x9c).
  166 
  167 ESC ]
  168      Operating System Command (OSC  is 0x9d).
  169 
  170 ESC ^
  171      Privacy Message (PM  is 0x9e).
  172 
  173 ESC _
  174      Application Program Command (APC  is 0x9f).
  175 
  176 
  177 These control characters are used in the vtXXX emulation.
  178 
  179 
  180 VT100 Mode
  181 
  182 In this document, "VT100" refers not only to VT100/VT102, but also to
  183 the succession of upward-compatible terminals produced by DEC (Digital
  184 Equipment Corporation) from the mid-1970s for about twenty years.  For
  185 brevity, the document refers to the related models:
  186   "VT200" as VT220/VT240,
  187   "VT300" as VT320/VT340,
  188   "VT400" as VT420, and
  189   "VT500" as VT510/VT520/VT525.
  190 
  191 Most of these control sequences are standard VT102 control sequences,
  192 but there is support for later DEC VT terminals (i.e., VT220, VT320,
  193 VT420, VT510), as well as ECMA-48 and aixterm color controls.  The only
  194 VT102 feature not supported is auto-repeat, since the only way X pro-
  195 vides for this will affect all windows.
  196 
  197 There are additional control sequences to provide xterm-dependent func-
  198 tions, such as the scrollbar or window size.  Where the function is
  199 specified by DEC or ECMA-48, the code assigned to it is given in paren-
  200 theses.
  201 
  202 The escape codes to designate and invoke character sets are specified by
  203 ISO 2022 (see that document for a discussion of character sets).
  204 
  205 Many of the features are optional; xterm can be configured and built
  206 without support for them.
  207 
  208 
  209 Single-character functions
  210 
  211 BEL       Bell (BEL  is Ctrl-G).
  212 
  213 BS        Backspace (BS  is Ctrl-H).
  214 
  215 CR        Carriage Return (CR  is Ctrl-M).
  216 
  217 ENQ       Return Terminal Status (ENQ  is Ctrl-E).  Default response is
  218           an empty string, but may be overridden by a resource answer-
  219           backString.
  220 
  221 FF        Form Feed or New Page (NP ).  (FF  is Ctrl-L).  FF  is treated
  222           the same as LF .
  223 
  224 LF        Line Feed or New Line (NL).  (LF  is Ctrl-J).
  225 
  226 SI        Switch to Standard Character Set (Ctrl-O is Shift In or LS0).
  227           This invokes the G0 character set (the default) as GL.
  228           VT200 and up implement LS0.
  229 
  230 SO        Switch to Alternate Character Set (Ctrl-N is Shift Out or
  231           LS1).  This invokes the G1 character set as GL.
  232           VT200 and up implement LS1.
  233 
  234 SP        Space.
  235 
  236 TAB       Horizontal Tab (HTS  is Ctrl-I).
  237 
  238 VT        Vertical Tab (VT  is Ctrl-K).  This is treated the same as LF.
  239 
  240 
  241 Controls beginning with ESC
  242 
  243 This excludes controls where ESC  is part of a 7-bit equivalent to 8-bit
  244 C1 controls, ordered by the final character(s).
  245 
  246 ESC SP F  7-bit controls (S7C1T), VT220.  This tells the terminal to
  247           send C1 control characters as 7-bit sequences, e.g., its
  248           responses to queries.  DEC VT200 and up always accept 8-bit
  249           control sequences except when configured for VT100 mode.
  250 
  251 ESC SP G  8-bit controls (S8C1T), VT220.  This tells the terminal to
  252           send C1 control characters as 8-bit sequences, e.g., its
  253           responses to queries.  DEC VT200 and up always accept 8-bit
  254           control sequences except when configured for VT100 mode.
  255 
  256 ESC SP L  Set ANSI conformance level 1, ECMA-43.
  257 
  258 ESC SP M  Set ANSI conformance level 2, ECMA-43.
  259 
  260 ESC SP N  Set ANSI conformance level 3, ECMA-43.
  261 
  262 ESC # 3   DEC double-height line, top half (DECDHL), VT100.
  263 
  264 ESC # 4   DEC double-height line, bottom half (DECDHL), VT100.
  265 
  266 ESC # 5   DEC single-width line (DECSWL), VT100.
  267 
  268 ESC # 6   DEC double-width line (DECDWL), VT100.
  269 
  270 ESC # 8   DEC Screen Alignment Test (DECALN), VT100.
  271 
  272 ESC % @   Select default character set.  That is ISO 8859-1 (ISO 2022).
  273 
  274 ESC % G   Select UTF-8 character set, ISO 2022.
  275 
  276 ESC ( C   Designate G0 Character Set, VT100, ISO 2022.
  277           Final character C for designating 94-character sets.  In this
  278           list,
  279           o   0 , A  and B  were introduced in the VT100,
  280           o   most were introduced in the VT200 series,
  281           o   a few were introduced in the VT300 series, and
  282           o   a few more were introduced in the VT500 series.
  283           The VT220 character sets, together with a few others (such as
  284           Portuguese) are activated by the National Replacement Charac-
  285           ter Set (NRCS) controls.  The term "replacement" says that the
  286           character set is formed by replacing some of the characters in
  287           a set (termed the Multinational Character Set) with more use-
  288           ful ones for a given language.  The ASCII and DEC Supplemental
  289           character sets make up the two halves of the Multinational
  290           Character set, initially mapped to GL and GR.
  291           The valid final characters C for this control are:
  292             C = A  -> United Kingdom (UK), VT100.
  293             C = B  -> United States (USASCII), VT100.
  294             C = C  or 5  -> Finnish, VT200.
  295             C = H  or 7  -> Swedish, VT200.
  296             C = K  -> German, VT200.
  297             C = Q  or 9  -> French Canadian, VT200.
  298             C = R  or f  -> French, VT200.
  299             C = Y  -> Italian, VT200.
  300             C = Z  -> Spanish, VT200.
  301             C = 4  -> Dutch, VT200.
  302             C = " >  -> Greek, VT500.
  303             C = % 2  -> Turkish, VT500.
  304             C = % 6  -> Portuguese, VT300.
  305             C = % =  -> Hebrew, VT500.
  306             C = =  -> Swiss, VT200.
  307             C = ` , E  or 6  -> Norwegian/Danish, VT200.
  308           The final character A  is a special case, since the same final
  309           character is used by the VT300-control for the 96-character
  310           British Latin-1.
  311           There are a few other 94-character sets:
  312             C = 0  -> DEC Special Character and Line Drawing Set, VT100.
  313             C = <  -> DEC Supplemental, VT200.
  314             C = >  -> DEC Technical, VT300.
  315           These are documented as NRCS:
  316             C = " 4  -> DEC Hebrew, VT500.
  317             C = " ?  -> DEC Greek, VT500.
  318             C = % 0  -> DEC Turkish, VT500.
  319             C = % 5  -> DEC Supplemental Graphics, VT300.
  320             C = & 4  -> DEC Cyrillic, VT500.
  321           The VT520 reference manual lists a few more, but no documenta-
  322           tion has been found for the mappings:
  323             C = % 3  -> SCS NRCS, VT500.
  324             C = & 5  -> DEC Russian, VT500.
  325 
  326 ESC ) C   Designate G1 Character Set, ISO 2022, VT100.
  327           The same character sets apply as for ESC ( C.
  328 
  329 ESC * C   Designate G2 Character Set, ISO 2022, VT220.
  330           The same character sets apply as for ESC ( C.
  331 
  332 ESC + C   Designate G3 Character Set, ISO 2022, VT220.
  333           The same character sets apply as for ESC ( C.
  334 
  335 ESC - C   Designate G1 Character Set, VT300.
  336           These controls apply only to 96-character sets.  Unlike the
  337           94-character sets, these can have different values than ASCII
  338           space and DEL for the mapping of 0x20 and 0x7f.  The valid
  339           final characters C for this control are:
  340             C = A  -> ISO Latin-1 Supplemental, VT300.
  341             C = F  -> ISO Greek Supplemental, VT500.
  342             C = H  -> ISO Hebrew Supplemental, VT500.
  343             C = L  -> ISO Latin-Cyrillic, VT500.
  344             C = M  -> ISO Latin-5 Supplemental, VT500.
  345 
  346 ESC . C   Designate G2 Character Set, VT300.
  347           The same character sets apply as for ESC - C.
  348 
  349 ESC / C   Designate G3 Character Set, VT300.
  350           The same character sets apply as for ESC - C.
  351 
  352 ESC 6     Back Index (DECBI), VT420 and up.
  353 
  354 ESC 7     Save Cursor (DECSC), VT100.
  355 
  356 ESC 8     Restore Cursor (DECRC), VT100.
  357 
  358 ESC 9     Forward Index (DECFI), VT420 and up.
  359 
  360 ESC =     Application Keypad (DECKPAM).
  361 
  362 ESC >     Normal Keypad (DECKPNM), VT100.
  363 
  364 ESC F     Cursor to lower left corner of screen.  This is enabled by the
  365           hpLowerleftBugCompat resource.
  366 
  367 ESC c     Full Reset (RIS), VT100.
  368 
  369 ESC l     Memory Lock (per HP terminals).  Locks memory above the cur-
  370           sor.
  371 
  372 ESC m     Memory Unlock (per HP terminals).
  373 
  374 ESC n     Invoke the G2 Character Set as GL (LS2) as GL.
  375 
  376 ESC o     Invoke the G3 Character Set as GL (LS3) as GL.
  377 
  378 ESC |     Invoke the G3 Character Set as GR (LS3R).
  379 
  380 ESC }     Invoke the G2 Character Set as GR (LS2R).
  381 
  382 ESC ~     Invoke the G1 Character Set as GR (LS1R), VT100.
  383 
  384 
  385 Application Program-Command functions
  386 
  387 APC Pt ST None.  xterm implements no APC  functions; Pt is ignored.  Pt
  388           need not be printable characters.
  389 
  390 
  391 Device-Control functions
  392 
  393 DCS Ps ; Ps | Pt ST
  394           User-Defined Keys (DECUDK), VT220 and up.
  395 
  396           The first parameter:
  397             Ps = 0  -> Clear all UDK definitions before starting
  398           (default).
  399             Ps = 1  -> Erase Below (default).
  400 
  401           The second parameter:
  402             Ps = 0  <- Lock the keys (default).
  403             Ps = 1  <- Do not lock.
  404 
  405           The third parameter is a ';'-separated list of strings denot-
  406           ing the key-code separated by a '/' from the hex-encoded key
  407           value.  The key codes correspond to the DEC function-key codes
  408           (e.g., F6=17).
  409 
  410 DCS $ q Pt ST
  411           Request Status String (DECRQSS), VT420 and up.
  412           The string following the "q" is one of the following:
  413             m       -> SGR
  414             " p     -> DECSCL
  415             SP q    -> DECSCUSR
  416             " q     -> DECSCA
  417             r       -> DECSTBM
  418             s       -> DECSLRM
  419             t       -> DECSLPP
  420             $ |     -> DECSCPP
  421             * |     -> DECSNLS
  422           xterm responds with DCS 1 $ r Pt ST for valid requests,
  423           replacing the Pt with the corresponding CSI string, or DCS 0 $
  424           r Pt ST for invalid requests.
  425 
  426 DCS Ps $ t Pt ST
  427           Restore presentation status (DECRSPS), VT320 and up.  The con-
  428           trol can be converted from a response from DECCIR or DECTABSR
  429           by changing the first "u" to a "t"
  430             Ps = 1  -> DECCIR
  431             Ps = 2  -> DECTABSR
  432 
  433 DCS + Q Pt ST
  434           Request resource values (XTGETXRES), xterm.  The string fol-
  435           lowing the "Q" is a list of names encoded in hexadecimal (2
  436           digits per character) separated by ; which correspond to xterm
  437           resource names.  Only boolean, numeric and string resources
  438           are supported by this query.
  439 
  440           xterm responds with
  441           DCS 1 + R Pt ST for valid requests, adding to Pt an = , and
  442           the value of the corresponding resource that xterm is using,
  443           or
  444           DCS 0 + R Pt ST for invalid requests.
  445           The strings are encoded in hexadecimal (2 digits per charac-
  446           ter).
  447 
  448 
  449 DCS + p Pt ST
  450           Set Termcap/Terminfo Data (XTSETTCAP), xterm.  The string fol-
  451           lowing the "p" is a name to use for retrieving data from the
  452           terminal database.  The data will be used for the "tcap" key-
  453           board configuration's function- and special-keys, as well as
  454           by the Request Termcap/Terminfo String control.
  455 
  456 
  457 DCS + q Pt ST
  458           Request Termcap/Terminfo String (XTGETTCAP), xterm.  The
  459           string following the "q" is a list of names encoded in hexa-
  460           decimal (2 digits per character) separated by ; which corre-
  461           spond to termcap or terminfo key names.
  462           A few special features are also recognized, which are not key
  463           names:
  464 
  465           o   Co for termcap colors (or colors for terminfo colors), and
  466 
  467           o   TN for termcap name (or name for terminfo name).
  468 
  469           o   RGB for the ncurses direct-color extension.
  470               Only a terminfo name is provided, since termcap applica-
  471               tions cannot use this information.
  472 
  473           xterm responds with
  474           DCS 1 + r Pt ST for valid requests, adding to Pt an = , and
  475           the value of the corresponding string that xterm would send,
  476           or
  477           DCS 0 + r Pt ST for invalid requests.
  478           The strings are encoded in hexadecimal (2 digits per charac-
  479           ter).
  480 
  481 
  482 Functions using CSI , ordered by the final character(s)
  483 
  484 CSI Ps @  Insert Ps (Blank) Character(s) (default = 1) (ICH).
  485 
  486 CSI Ps SP @
  487           Shift left Ps columns(s) (default = 1) (SL), ECMA-48.
  488 
  489 CSI Ps A  Cursor Up Ps Times (default = 1) (CUU).
  490 
  491 CSI Ps SP A
  492           Shift right Ps columns(s) (default = 1) (SR), ECMA-48.
  493 
  494 CSI Ps B  Cursor Down Ps Times (default = 1) (CUD).
  495 
  496 CSI Ps C  Cursor Forward Ps Times (default = 1) (CUF).
  497 
  498 CSI Ps D  Cursor Backward Ps Times (default = 1) (CUB).
  499 
  500 CSI Ps E  Cursor Next Line Ps Times (default = 1) (CNL).
  501 
  502 CSI Ps F  Cursor Preceding Line Ps Times (default = 1) (CPL).
  503 
  504 CSI Ps G  Cursor Character Absolute  [column] (default = [row,1]) (CHA).
  505 
  506 CSI Ps ; Ps H
  507           Cursor Position [row;column] (default = [1,1]) (CUP).
  508 
  509 CSI Ps I  Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
  510 
  511 CSI Ps J  Erase in Display (ED), VT100.
  512             Ps = 0  -> Erase Below (default).
  513             Ps = 1  -> Erase Above.
  514             Ps = 2  -> Erase All.
  515             Ps = 3  -> Erase Saved Lines, xterm.
  516 
  517 CSI ? Ps J
  518           Erase in Display (DECSED), VT220.
  519             Ps = 0  -> Selective Erase Below (default).
  520             Ps = 1  -> Selective Erase Above.
  521             Ps = 2  -> Selective Erase All.
  522             Ps = 3  -> Selective Erase Saved Lines, xterm.
  523 
  524 CSI Ps K  Erase in Line (EL), VT100.
  525             Ps = 0  -> Erase to Right (default).
  526             Ps = 1  -> Erase to Left.
  527             Ps = 2  -> Erase All.
  528 
  529 CSI ? Ps K
  530           Erase in Line (DECSEL), VT220.
  531             Ps = 0  -> Selective Erase to Right (default).
  532             Ps = 1  -> Selective Erase to Left.
  533             Ps = 2  -> Selective Erase All.
  534 
  535 CSI Ps L  Insert Ps Line(s) (default = 1) (IL).
  536 
  537 CSI Ps M  Delete Ps Line(s) (default = 1) (DL).
  538 
  539 CSI Ps P  Delete Ps Character(s) (default = 1) (DCH).
  540 
  541 CSI Ps S  Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48.
  542 
  543 CSI ? Pi ; Pa ; Pv S
  544           Set or request graphics attribute, xterm.  If configured to
  545           support either Sixel Graphics or ReGIS Graphics, xterm accepts
  546           a three-parameter control sequence, where Pi, Pa and Pv are
  547           the item, action and value:
  548 
  549             Pi = 1  -> item is number of color registers.
  550             Pi = 2  -> item is Sixel graphics geometry (in pixels).
  551             Pi = 3  -> item is ReGIS graphics geometry (in pixels).
  552 
  553             Pa = 1  -> read attribute.
  554             Pa = 2  -> reset to default.
  555             Pa = 3  -> set to value in Pv.
  556             Pa = 4  -> read the maximum allowed value.
  557 
  558             Pv can be omitted except when setting (Pa == 3 ).
  559             Pv = n <- A single integer is used for color registers.
  560             Pv = width ; height <- Two integers for graphics geometry.
  561 
  562           xterm replies with a control sequence of the same form:
  563 
  564                CSI ? Pi ; Ps ; Pv S
  565 
  566           where Ps is the status:
  567             Ps = 0  <- success.
  568             Ps = 1  <- error in Pi.
  569             Ps = 2  <- error in Pa.
  570             Ps = 3  <- failure.
  571 
  572           On success, Pv represents the value read or set.
  573 
  574           Notes:
  575           o   The current implementation allows reading the graphics
  576               sizes, but disallows modifying those sizes because that is
  577               done once, using resource-values.
  578           o   Graphics geometry is not necessarily the same as "window
  579               size" (see the dtterm window manipulation extensions).
  580               For example, xterm limits the maximum graphics geometry at
  581               compile time (1000x1000 as of version 328) although the
  582               window size can be larger.
  583           o   While resizing a window will always change the current
  584               graphics geometry, the reverse is not true.  Setting
  585               graphics geometry does not affect the window size.
  586 
  587 CSI Ps T  Scroll down Ps lines (default = 1) (SD), VT420.
  588 
  589 CSI Ps ; Ps ; Ps ; Ps ; Ps T
  590           Initiate highlight mouse tracking.  Parameters are
  591           [func;startx;starty;firstrow;lastrow].  See the section Mouse
  592           Tracking.
  593 
  594 CSI > Pm T
  595           Reset title mode features to default value, xterm.  Normally,
  596           "reset" disables the feature.  It is possible to disable the
  597           ability to reset features by compiling a different default for
  598           the title modes into xterm.
  599 
  600             Ps = 0  -> Do not set window/icon labels using hexadecimal.
  601             Ps = 1  -> Do not query window/icon labels using hexadeci-
  602           mal.
  603             Ps = 2  -> Do not set window/icon labels using UTF-8.
  604             Ps = 3  -> Do not query window/icon labels using UTF-8.
  605 
  606           (See discussion of Title Modes).
  607 
  608 CSI Ps X  Erase Ps Character(s) (default = 1) (ECH).
  609 
  610 CSI Ps Z  Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
  611 
  612 CSI Ps ^  Scroll down Ps lines (default = 1) (SD), ECMA-48.
  613           This was a publication error in the original ECMA-48 5th edi-
  614           tion (1991) corrected in 2003.
  615 
  616 CSI Pm `  Character Position Absolute  [column] (default = [row,1])
  617           (HPA).
  618 
  619 CSI Pm a  Character Position Relative  [columns] (default = [row,col+1])
  620           (HPR).
  621 
  622 CSI Ps b  Repeat the preceding graphic character Ps times (REP).
  623 
  624 CSI Ps c  Send Device Attributes (Primary DA).
  625             Ps = 0  or omitted -> request attributes from terminal.  The
  626           response depends on the decTerminalID resource setting.
  627             -> CSI ? 1 ; 2 c  ("VT100 with Advanced Video Option")
  628             -> CSI ? 1 ; 0 c  ("VT101 with No Options")
  629             -> CSI ? 6 c  ("VT102")
  630             -> CSI ? 6 2 ; Psc  ("VT220")
  631             -> CSI ? 6 3 ; Psc  ("VT320")
  632             -> CSI ? 6 4 ; Psc  ("VT420")
  633 
  634           The VT100-style response parameters do not mean anything by
  635           themselves.  VT220 (and higher) parameters do, telling the
  636           host what features the terminal supports:
  637             Ps = 1  -> 132-columns.
  638             Ps = 2  -> Printer.
  639             Ps = 3  -> ReGIS graphics.
  640             Ps = 4  -> Sixel graphics.
  641             Ps = 6  -> Selective erase.
  642             Ps = 8  -> User-defined keys.
  643             Ps = 9  -> National Replacement Character sets.
  644             Ps = 1 5  -> Technical characters.
  645             Ps = 1 6  -> Locator port.
  646             Ps = 1 7  -> Terminal state interrogation.
  647             Ps = 1 8  -> User windows.
  648             Ps = 2 1  -> Horizontal scrolling.
  649             Ps = 2 2  -> ANSI color, e.g., VT525.
  650             Ps = 2 8  -> Rectangular editing.
  651             Ps = 2 9  -> ANSI text locator (i.e., DEC Locator mode).
  652 
  653           XTerm supports part of the User windows feature, providing a
  654           single page (which corresponds to its visible window).  Rather
  655           than resizing the font to change the number of lines/columns
  656           in a fixed-size display, xterm uses the window extension con-
  657           trols (DECSNLS, DECSCPP, DECSLPP) to adjust its visible win-
  658           dow's size.  The "cursor coupling" controls (DECHCCM, DECPCCM,
  659           DECVCCM) are ignored.
  660 
  661 CSI = Ps c
  662           Send Device Attributes (Tertiary DA).
  663             Ps = 0  -> report Terminal Unit ID (default), VT400.  XTerm
  664           uses zeros for the site code and serial number in its DECRPTUI
  665           response.
  666 
  667 CSI > Ps c
  668           Send Device Attributes (Secondary DA).
  669             Ps = 0  or omitted -> request the terminal's identification
  670           code.  The response depends on the decTerminalID resource set-
  671           ting.  It should apply only to VT220 and up, but xterm extends
  672           this to VT100.
  673             -> CSI  > Pp ; Pv ; Pc c
  674           where Pp denotes the terminal type
  675             Pp = 0  -> "VT100".
  676             Pp = 1  -> "VT220".
  677             Pp = 2  -> "VT240".
  678             Pp = 1 8  -> "VT330".
  679             Pp = 1 9  -> "VT340".
  680             Pp = 2 4  -> "VT320".
  681             Pp = 4 1  -> "VT420".
  682             Pp = 6 1  -> "VT510".
  683             Pp = 6 4  -> "VT520".
  684             Pp = 6 5  -> "VT525".
  685 
  686           and Pv is the firmware version (for xterm, this was originally
  687           the XFree86 patch number, starting with 95).  In a DEC termi-
  688           nal, Pc indicates the ROM cartridge registration number and is
  689           always zero.
  690 
  691 CSI Pm d  Line Position Absolute  [row] (default = [1,column]) (VPA).
  692 
  693 CSI Pm e  Line Position Relative  [rows] (default = [row+1,column])
  694           (VPR).
  695 
  696 CSI Ps ; Ps f
  697           Horizontal and Vertical Position [row;column] (default =
  698           [1,1]) (HVP).
  699 
  700 CSI Ps g  Tab Clear (TBC).
  701             Ps = 0  -> Clear Current Column (default).
  702             Ps = 3  -> Clear All.
  703 
  704 CSI Pm h  Set Mode (SM).
  705             Ps = 2  -> Keyboard Action Mode (AM).
  706             Ps = 4  -> Insert Mode (IRM).
  707             Ps = 1 2  -> Send/receive (SRM).
  708             Ps = 2 0  -> Automatic Newline (LNM).
  709 
  710 CSI ? Pm h
  711           DEC Private Mode Set (DECSET).
  712             Ps = 1  -> Application Cursor Keys (DECCKM), VT100.
  713             Ps = 2  -> Designate USASCII for character sets G0-G3
  714           (DECANM), VT100, and set VT100 mode.
  715             Ps = 3  -> 132 Column Mode (DECCOLM), VT100.
  716             Ps = 4  -> Smooth (Slow) Scroll (DECSCLM), VT100.
  717             Ps = 5  -> Reverse Video (DECSCNM), VT100.
  718             Ps = 6  -> Origin Mode (DECOM), VT100.
  719             Ps = 7  -> Auto-wrap Mode (DECAWM), VT100.
  720             Ps = 8  -> Auto-repeat Keys (DECARM), VT100.
  721             Ps = 9  -> Send Mouse X & Y on button press.  See the sec-
  722           tion Mouse Tracking.  This is the X10 xterm mouse protocol.
  723             Ps = 1 0  -> Show toolbar (rxvt).
  724             Ps = 1 2  -> Start Blinking Cursor (AT&T 610).
  725             Ps = 1 3  -> Start Blinking Cursor (set only via resource or
  726           menu).
  727             Ps = 1 4  -> Enable XOR of Blinking Cursor control sequence
  728           and menu.
  729             Ps = 1 8  -> Print form feed (DECPFF), VT220.
  730             Ps = 1 9  -> Set print extent to full screen (DECPEX),
  731           VT220.
  732             Ps = 2 5  -> Show Cursor (DECTCEM), VT220.
  733             Ps = 3 0  -> Show scrollbar (rxvt).
  734             Ps = 3 5  -> Enable font-shifting functions (rxvt).
  735             Ps = 3 8  -> Enter Tektronix Mode (DECTEK), VT240, xterm.
  736             Ps = 4 0  -> Allow 80 -> 132 Mode, xterm.
  737             Ps = 4 1  -> more(1) fix (see curses resource).
  738             Ps = 4 2  -> Enable National Replacement Character sets
  739           (DECNRCM), VT220.
  740             Ps = 4 4  -> Turn On Margin Bell, xterm.
  741             Ps = 4 5  -> Reverse-wraparound Mode, xterm.
  742             Ps = 4 6  -> Start Logging, xterm.  This is normally dis-
  743           abled by a compile-time option.
  744             Ps = 4 7  -> Use Alternate Screen Buffer, xterm.  This may
  745           be disabled by the titeInhibit resource.
  746             Ps = 6 6  -> Application keypad (DECNKM), VT320.
  747             Ps = 6 7  -> Backarrow key sends backspace (DECBKM), VT340,
  748           VT420.  This sets the backarrowKey resource to "true".
  749             Ps = 6 9  -> Enable left and right margin mode (DECLRMM),
  750           VT420 and up.
  751             Ps = 8 0  -> Enable Sixel Scrolling (DECSDM).
  752             Ps = 9 5  -> Do not clear screen when DECCOLM is set/reset
  753           (DECNCSM), VT510 and up.
  754             Ps = 1 0 0 0  -> Send Mouse X & Y on button press and
  755           release.  See the section Mouse Tracking.  This is the X11
  756           xterm mouse protocol.
  757             Ps = 1 0 0 1  -> Use Hilite Mouse Tracking, xterm.
  758             Ps = 1 0 0 2  -> Use Cell Motion Mouse Tracking, xterm.  See
  759           the section Button-event tracking.
  760             Ps = 1 0 0 3  -> Use All Motion Mouse Tracking, xterm.  See
  761           the section Any-event tracking.
  762             Ps = 1 0 0 4  -> Send FocusIn/FocusOut events, xterm.
  763             Ps = 1 0 0 5  -> Enable UTF-8 Mouse Mode, xterm.
  764             Ps = 1 0 0 6  -> Enable SGR Mouse Mode, xterm.
  765             Ps = 1 0 0 7  -> Enable Alternate Scroll Mode, xterm.  This
  766           corresponds to the alternateScroll resource.
  767             Ps = 1 0 1 0  -> Scroll to bottom on tty output (rxvt).
  768           This sets the scrollTtyOutput resource to "true".
  769             Ps = 1 0 1 1  -> Scroll to bottom on key press (rxvt).  This
  770           sets the scrollKey resource to "true".
  771             Ps = 1 0 1 5  -> Enable urxvt Mouse Mode.
  772             Ps = 1 0 3 4  -> Interpret "meta" key, xterm.  This sets the
  773           eighth bit of keyboard input (and enables the eightBitInput
  774           resource).
  775             Ps = 1 0 3 5  -> Enable special modifiers for Alt and Num-
  776           Lock keys, xterm.  This enables the numLock resource.
  777             Ps = 1 0 3 6  -> Send ESC   when Meta modifies a key, xterm.
  778           This enables the metaSendsEscape resource.
  779             Ps = 1 0 3 7  -> Send DEL from the editing-keypad Delete
  780           key, xterm.
  781             Ps = 1 0 3 9  -> Send ESC  when Alt modifies a key, xterm.
  782           This enables the altSendsEscape resource, xterm.
  783             Ps = 1 0 4 0  -> Keep selection even if not highlighted,
  784           xterm.  This enables the keepSelection resource.
  785             Ps = 1 0 4 1  -> Use the CLIPBOARD selection, xterm.  This
  786           enables the selectToClipboard resource.
  787             Ps = 1 0 4 2  -> Enable Urgency window manager hint when
  788           Control-G is received, xterm.  This enables the bellIsUrgent
  789           resource.
  790             Ps = 1 0 4 3  -> Enable raising of the window when Control-G
  791           is received, xterm.  This enables the popOnBell resource.
  792             Ps = 1 0 4 4  -> Reuse the most recent data copied to CLIP-
  793           BOARD, xterm.  This enables the keepClipboard resource.
  794             Ps = 1 0 4 6  -> Enable switching to/from Alternate Screen
  795           Buffer, xterm.  This works for terminfo-based systems, updat-
  796           ing the titeInhibit resource.
  797             Ps = 1 0 4 7  -> Use Alternate Screen Buffer, xterm.  This
  798           may be disabled by the titeInhibit resource.
  799             Ps = 1 0 4 8  -> Save cursor as in DECSC, xterm.  This may
  800           be disabled by the titeInhibit resource.
  801             Ps = 1 0 4 9  -> Save cursor as in DECSC, xterm.  After sav-
  802           ing the cursor, switch to the Alternate Screen Buffer, clear-
  803           ing it first.  This may be disabled by the titeInhibit
  804           resource.  This control combines the effects of the 1 0 4 7
  805           and 1 0 4 8  modes.  Use this with terminfo-based applications
  806           rather than the 4 7  mode.
  807             Ps = 1 0 5 0  -> Set terminfo/termcap function-key mode,
  808           xterm.
  809             Ps = 1 0 5 1  -> Set Sun function-key mode, xterm.
  810             Ps = 1 0 5 2  -> Set HP function-key mode, xterm.
  811             Ps = 1 0 5 3  -> Set SCO function-key mode, xterm.
  812             Ps = 1 0 6 0  -> Set legacy keyboard emulation, i.e, X11R6,
  813           xterm.
  814             Ps = 1 0 6 1  -> Set VT220 keyboard emulation, xterm.
  815             Ps = 2 0 0 4  -> Set bracketed paste mode, xterm.
  816 
  817 CSI Pm i  Media Copy (MC).
  818             Ps = 0  -> Print screen (default).
  819             Ps = 4  -> Turn off printer controller mode.
  820             Ps = 5  -> Turn on printer controller mode.
  821             Ps = 1 0  -> HTML screen dump, xterm.
  822             Ps = 1 1  -> SVG screen dump, xterm.
  823 
  824 CSI ? Pm i
  825           Media Copy (MC), DEC-specific.
  826             Ps = 1  -> Print line containing cursor.
  827             Ps = 4  -> Turn off autoprint mode.
  828             Ps = 5  -> Turn on autoprint mode.
  829             Ps = 1 0  -> Print composed display, ignores DECPEX.
  830             Ps = 1 1  -> Print all pages.
  831 
  832 CSI Pm l  Reset Mode (RM).
  833             Ps = 2  -> Keyboard Action Mode (AM).
  834             Ps = 4  -> Replace Mode (IRM).
  835             Ps = 1 2  -> Send/receive (SRM).
  836             Ps = 2 0  -> Normal Linefeed (LNM).
  837 
  838 CSI ? Pm l
  839           DEC Private Mode Reset (DECRST).
  840             Ps = 1  -> Normal Cursor Keys (DECCKM), VT100.
  841             Ps = 2  -> Designate VT52 mode (DECANM), VT100.
  842             Ps = 3  -> 80 Column Mode (DECCOLM), VT100.
  843             Ps = 4  -> Jump (Fast) Scroll (DECSCLM), VT100.
  844             Ps = 5  -> Normal Video (DECSCNM), VT100.
  845             Ps = 6  -> Normal Cursor Mode (DECOM), VT100.
  846             Ps = 7  -> No Auto-wrap Mode (DECAWM), VT100.
  847             Ps = 8  -> No Auto-repeat Keys (DECARM), VT100.
  848             Ps = 9  -> Don't send Mouse X & Y on button press, xterm.
  849             Ps = 1 0  -> Hide toolbar (rxvt).
  850             Ps = 1 2  -> Stop Blinking Cursor (AT&T 610).
  851             Ps = 1 3  -> Disable Blinking Cursor (reset only via
  852           resource or menu).
  853             Ps = 1 4  -> Disable XOR of Blinking Cursor control sequence
  854           and menu.
  855             Ps = 1 8  -> Don't print form feed (DECPFF).
  856             Ps = 1 9  -> Limit print to scrolling region (DECPEX).
  857             Ps = 2 5  -> Hide Cursor (DECTCEM), VT220.
  858             Ps = 3 0  -> Don't show scrollbar (rxvt).
  859             Ps = 3 5  -> Disable font-shifting functions (rxvt).
  860             Ps = 4 0  -> Disallow 80 -> 132 Mode, xterm.
  861             Ps = 4 1  -> No more(1) fix (see curses resource).
  862             Ps = 4 2  -> Disable National Replacement Character sets
  863           (DECNRCM), VT220.
  864             Ps = 4 4  -> Turn Off Margin Bell, xterm.
  865             Ps = 4 5  -> No Reverse-wraparound Mode, xterm.
  866             Ps = 4 6  -> Stop Logging, xterm.  This is normally disabled
  867           by a compile-time option.
  868             Ps = 4 7  -> Use Normal Screen Buffer, xterm.
  869             Ps = 6 6  -> Numeric keypad (DECNKM), VT320.
  870             Ps = 6 7  -> Backarrow key sends delete (DECBKM), VT340,
  871           VT420.  This sets the backarrowKey resource to "false".
  872             Ps = 6 9  -> Disable left and right margin mode (DECLRMM),
  873           VT420 and up.
  874             Ps = 8 0  -> Disable Sixel Scrolling (DECSDM).
  875             Ps = 9 5  -> Clear screen when DECCOLM is set/reset (DEC-
  876           NCSM), VT510 and up.
  877             Ps = 1 0 0 0  -> Don't send Mouse X & Y on button press and
  878           release.  See the section Mouse Tracking.
  879             Ps = 1 0 0 1  -> Don't use Hilite Mouse Tracking, xterm.
  880             Ps = 1 0 0 2  -> Don't use Cell Motion Mouse Tracking,
  881           xterm.  See the section Button-event tracking.
  882             Ps = 1 0 0 3  -> Don't use All Motion Mouse Tracking, xterm.
  883           See the section Any-event tracking.
  884             Ps = 1 0 0 4  -> Don't send FocusIn/FocusOut events, xterm.
  885             Ps = 1 0 0 5  -> Disable UTF-8 Mouse Mode, xterm.
  886             Ps = 1 0 0 6  -> Disable SGR Mouse Mode, xterm.
  887             Ps = 1 0 0 7  -> Disable Alternate Scroll Mode, xterm.  This
  888           corresponds to the alternateScroll resource.
  889             Ps = 1 0 1 0  -> Don't scroll to bottom on tty output
  890           (rxvt).  This sets the scrollTtyOutput resource to "false".
  891             Ps = 1 0 1 1  -> Don't scroll to bottom on key press (rxvt).
  892           This sets the scrollKey resource to "false".
  893             Ps = 1 0 1 5  -> Disable urxvt Mouse Mode.
  894             Ps = 1 0 3 4  -> Don't interpret "meta" key, xterm.  This
  895           disables the eightBitInput resource.
  896             Ps = 1 0 3 5  -> Disable special modifiers for Alt and Num-
  897           Lock keys, xterm.  This disables the numLock resource.
  898             Ps = 1 0 3 6  -> Don't send ESC  when Meta modifies a key,
  899           xterm.  This disables the metaSendsEscape resource.
  900             Ps = 1 0 3 7  -> Send VT220 Remove from the editing-keypad
  901           Delete key, xterm.
  902             Ps = 1 0 3 9  -> Don't send ESC when Alt modifies a key,
  903           xterm.  This disables the altSendsEscape resource.
  904             Ps = 1 0 4 0  -> Do not keep selection when not highlighted,
  905           xterm.  This disables the keepSelection resource.
  906             Ps = 1 0 4 1  -> Use the PRIMARY selection, xterm.  This
  907           disables the selectToClipboard resource.
  908             Ps = 1 0 4 2  -> Disable Urgency window manager hint when
  909           Control-G is received, xterm.  This disables the bellIsUrgent
  910           resource.
  911             Ps = 1 0 4 3  -> Disable raising of the window when Control-
  912           G is received, xterm.  This disables the popOnBell resource.
  913             Ps = 1 0 4 6  -> Disable switching to/from Alternate Screen
  914           Buffer, xterm.  This works for terminfo-based systems, updat-
  915           ing the titeInhibit resource.  If currently using the Alter-
  916           nate Screen Buffer, xterm switches to the Normal Screen Buf-
  917           fer.
  918             Ps = 1 0 4 7  -> Use Normal Screen Buffer, xterm.  Clear the
  919           screen first if in the Alternate Screen Buffer.  This may be
  920           disabled by the titeInhibit resource.
  921             Ps = 1 0 4 8  -> Restore cursor as in DECRC, xterm.  This
  922           may be disabled by the titeInhibit resource.
  923             Ps = 1 0 4 9  -> Use Normal Screen Buffer and restore cursor
  924           as in DECRC, xterm.  This may be disabled by the titeInhibit
  925           resource.  This combines the effects of the 1 0 4 7  and 1 0 4
  926           8  modes.  Use this with terminfo-based applications rather
  927           than the 4 7  mode.
  928             Ps = 1 0 5 0  -> Reset terminfo/termcap function-key mode,
  929           xterm.
  930             Ps = 1 0 5 1  -> Reset Sun function-key mode, xterm.
  931             Ps = 1 0 5 2  -> Reset HP function-key mode, xterm.
  932             Ps = 1 0 5 3  -> Reset SCO function-key mode, xterm.
  933             Ps = 1 0 6 0  -> Reset legacy keyboard emulation, i.e,
  934           X11R6, xterm.
  935             Ps = 1 0 6 1  -> Reset keyboard emulation to Sun/PC style,
  936           xterm.
  937             Ps = 2 0 0 4  -> Reset bracketed paste mode, xterm.
  938 
  939 CSI Pm m  Character Attributes (SGR).
  940             Ps = 0  -> Normal (default), VT100.
  941             Ps = 1  -> Bold, VT100.
  942             Ps = 2  -> Faint, decreased intensity, ECMA-48 2nd.
  943             Ps = 3  -> Italicized, ECMA-48 2nd.
  944             Ps = 4  -> Underlined, VT100.
  945             Ps = 5  -> Blink, VT100.
  946           This appears as Bold in X11R6 xterm.
  947             Ps = 7  -> Inverse, VT100.
  948             Ps = 8  -> Invisible, i.e., hidden, ECMA-48 2nd, VT300.
  949             Ps = 9  -> Crossed-out characters, ECMA-48 3rd.
  950             Ps = 2 1  -> Doubly-underlined, ECMA-48 3rd.
  951             Ps = 2 2  -> Normal (neither bold nor faint), ECMA-48 3rd.
  952             Ps = 2 3  -> Not italicized, ECMA-48 3rd.
  953             Ps = 2 4  -> Not underlined, ECMA-48 3rd.
  954             Ps = 2 5  -> Steady (not blinking), ECMA-48 3rd.
  955             Ps = 2 7  -> Positive (not inverse), ECMA-48 3rd.
  956             Ps = 2 8  -> Visible, i.e., not hidden, ECMA-48 3rd, VT300.
  957             Ps = 2 9  -> Not crossed-out, ECMA-48 3rd.
  958             Ps = 3 0  -> Set foreground color to Black.
  959             Ps = 3 1  -> Set foreground color to Red.
  960             Ps = 3 2  -> Set foreground color to Green.
  961             Ps = 3 3  -> Set foreground color to Yellow.
  962             Ps = 3 4  -> Set foreground color to Blue.
  963             Ps = 3 5  -> Set foreground color to Magenta.
  964             Ps = 3 6  -> Set foreground color to Cyan.
  965             Ps = 3 7  -> Set foreground color to White.
  966             Ps = 3 9  -> Set foreground color to default, ECMA-48 3rd.
  967             Ps = 4 0  -> Set background color to Black.
  968             Ps = 4 1  -> Set background color to Red.
  969             Ps = 4 2  -> Set background color to Green.
  970             Ps = 4 3  -> Set background color to Yellow.
  971             Ps = 4 4  -> Set background color to Blue.
  972             Ps = 4 5  -> Set background color to Magenta.
  973             Ps = 4 6  -> Set background color to Cyan.
  974             Ps = 4 7  -> Set background color to White.
  975             Ps = 4 9  -> Set background color to default, ECMA-48 3rd.
  976 
  977           Some of the above note the edition of ECMA-48 which first
  978           describes a feature.  In its successive editions from 1979 to
  979           1991 (2nd 1979, 3rd 1984, 4th 1986, and 5th 1991), ECMA-48
  980           listed codes through 6 5 (skipping several toward the end of
  981           the range).  Most of the ECMA-48 codes not implemented in
  982           xterm were never implemented in a hardware terminal.  Several
  983           (such as 3 9  and 4 9 ) are either noted in ECMA-48 as imple-
  984           mentation defined, or described in vague terms.
  985 
  986           The successive editions of ECMA-48 give little attention to
  987           changes from one edition to the next, except to comment on
  988           features which have become obsolete.  ECMA-48 1st (1976) is
  989           unavailable; there is no reliable source of information which
  990           states whether "ANSI" color was defined in that edition, or
  991           later (1979).  The VT100 (1978) implemented the most commonly
  992           used non-color video attributes which are given in the 2nd
  993           edition.
  994 
  995           While 8-color support is described in ECMA-48 2nd edition, the
  996           VT500 series (introduced in 1993) were the first DEC terminals
  997           implementing "ANSI" color.  The DEC terminal's use of color is
  998           known to differ from xterm; useful documentation on this
  999           series became available too late to influence xterm.
 1000 
 1001           If 16-color support is compiled, the following aixterm con-
 1002           trols apply.  Assume that xterm's resources are set so that
 1003           the ISO color codes are the first 8 of a set of 16.  Then the
 1004           aixterm colors are the bright versions of the ISO colors:
 1005 
 1006             Ps = 9 0  -> Set foreground color to Black.
 1007             Ps = 9 1  -> Set foreground color to Red.
 1008             Ps = 9 2  -> Set foreground color to Green.
 1009             Ps = 9 3  -> Set foreground color to Yellow.
 1010             Ps = 9 4  -> Set foreground color to Blue.
 1011             Ps = 9 5  -> Set foreground color to Magenta.
 1012             Ps = 9 6  -> Set foreground color to Cyan.
 1013             Ps = 9 7  -> Set foreground color to White.
 1014             Ps = 1 0 0  -> Set background color to Black.
 1015             Ps = 1 0 1  -> Set background color to Red.
 1016             Ps = 1 0 2  -> Set background color to Green.
 1017             Ps = 1 0 3  -> Set background color to Yellow.
 1018             Ps = 1 0 4  -> Set background color to Blue.
 1019             Ps = 1 0 5  -> Set background color to Magenta.
 1020             Ps = 1 0 6  -> Set background color to Cyan.
 1021             Ps = 1 0 7  -> Set background color to White.
 1022 
 1023           If xterm is compiled with the 16-color support disabled, it
 1024           supports the following, from rxvt:
 1025             Ps = 1 0 0  -> Set foreground and background color to
 1026           default.
 1027 
 1028           XTerm maintains a color palette whose entries are identified
 1029           by an index beginning with zero.  If 88- or 256-color support
 1030           is compiled, the following apply:
 1031           o   All parameters are decimal integers.
 1032           o   RGB values range from zero (0) to 255.
 1033           o   ISO-8613-6 has been interpreted in more than one way;
 1034               xterm allows the semicolons separating the subparameters
 1035               in this control to be replaced by colons (but after the
 1036               first colon, colons must be used).
 1037 
 1038           These ISO-8613-6 controls (marked in ECMA-48 5th edition as
 1039           "reserved for future standardization") are supported by xterm:
 1040             Pm = 3 8 ; 2 ; Pi ; Pr ; Pg ; Pb -> Set foreground color
 1041           using RGB values.  If xterm is not compiled with direct-color
 1042           support, it uses the closest match in its palette for the
 1043           given RGB Pr/Pg/Pb.  The color space identifier Pi is ignored.
 1044             Pm = 3 8 ; 5 ; Ps -> Set foreground color to Ps, using
 1045           indexed color.
 1046             Pm = 4 8 ; 2 ; Pi ; Pr ; Pg ; Pb -> Set background color
 1047           using RGB values.  If xterm is not compiled with direct-color
 1048           support, it uses the closest match in its palette for the
 1049           given RGB Pr/Pg/Pb.  The color space identifier Pi is ignored.
 1050             Pm = 4 8 ; 5 ; Ps -> Set background color to Ps, using
 1051           indexed color.
 1052 
 1053           This variation on ISO-8613-6 is supported for compatibility
 1054           with KDE konsole:
 1055             Pm = 3 8 ; 2 ; Pr ; Pg ; Pb -> Set foreground color using
 1056           RGB values.  If xterm is not compiled with direct-color sup-
 1057           port, it uses the closest match in its palette for the given
 1058           RGB Pr/Pg/Pb.
 1059             Pm = 4 8 ; 2 ; Pr ; Pg ; Pb -> Set background color using
 1060           RGB values.  If xterm is not compiled with direct-color sup-
 1061           port, it uses the closest match in its palette for the given
 1062           RGB Pr/Pg/Pb.
 1063 
 1064           In each case, if xterm is compiled with direct-color support,
 1065           and the resource directColor is true, then rather than choos-
 1066           ing the closest match, xterm asks the X server to directly
 1067           render a given color.
 1068 
 1069 CSI > Pp ; Pv m
 1070 CSI > Pp m
 1071           Set/reset key modifier options, xterm.  Set or reset resource-
 1072           values used by xterm to decide whether to construct escape
 1073           sequences holding information about the modifiers pressed with
 1074           a given key.
 1075 
 1076           The first parameter Pp identifies the resource to set/reset.
 1077           The second parameter Pv is the value to assign to the
 1078           resource.
 1079 
 1080           If the second parameter is omitted, the resource is reset to
 1081           its initial value.  Values 3  and 5  are reserved for keypad-
 1082           keys and string-keys.
 1083 
 1084             Pp = 0  -> modifyKeyboard.
 1085             Pp = 1  -> modifyCursorKeys.
 1086             Pp = 2  -> modifyFunctionKeys.
 1087             Pp = 4  -> modifyOtherKeys.
 1088 
 1089           If no parameters are given, all resources are reset to their
 1090           initial values.
 1091 
 1092 CSI Ps n  Device Status Report (DSR).
 1093             Ps = 5  -> Status Report.
 1094           Result ("OK") is CSI 0 n
 1095             Ps = 6  -> Report Cursor Position (CPR) [row;column].
 1096           Result is CSI r ; c R
 1097 
 1098           Note: it is possible for this sequence to be sent by a func-
 1099           tion key.  For example, with the default keyboard configura-
 1100           tion the shifted F1 key may send (with shift-, control-, alt-
 1101           modifiers)
 1102 
 1103             CSI 1 ; 2  R , or
 1104             CSI 1 ; 5  R , or
 1105             CSI 1 ; 6  R , etc.
 1106 
 1107           The second parameter encodes the modifiers; values range from
 1108           2 to 16.  See the section PC-Style Function Keys for the
 1109           codes.  The modifyFunctionKeys and modifyKeyboard resources
 1110           can change the form of the string sent from the modified F1
 1111           key.
 1112 
 1113 CSI > Pm n
 1114           Disable key modifier options, xterm.  These modifiers may be
 1115           enabled via the CSI > Pm m sequence.  This control sequence
 1116           corresponds to a resource value of "-1", which cannot be set
 1117           with the other sequence.
 1118 
 1119           The parameter identifies the resource to be disabled:
 1120 
 1121             Ps = 0  -> modifyKeyboard.
 1122             Ps = 1  -> modifyCursorKeys.
 1123             Ps = 2  -> modifyFunctionKeys.
 1124             Ps = 4  -> modifyOtherKeys.
 1125 
 1126           If the parameter is omitted, modifyFunctionKeys is disabled.
 1127           When modifyFunctionKeys is disabled, xterm uses the modifier
 1128           keys to make an extended sequence of function keys rather than
 1129           adding a parameter to each function key to denote the modi-
 1130           fiers.
 1131 
 1132 CSI ? Ps n
 1133           Device Status Report (DSR, DEC-specific).
 1134             Ps = 6  -> Report Cursor Position (DECXCPR).  The response
 1135           [row;column] is returned as
 1136           CSI ? r ; c R
 1137           (assumes the default page, i.e., "1").
 1138             Ps = 1 5  -> Report Printer status.  The response is
 1139           CSI ? 1 0 n  (ready).  or
 1140           CSI ? 1 1 n  (not ready).
 1141             Ps = 2 5  -> Report UDK status.  The response is
 1142           CSI ? 2 0 n  (unlocked)
 1143           or
 1144           CSI ? 2 1 n  (locked).
 1145             Ps = 2 6  -> Report Keyboard status.  The response is
 1146           CSI ? 2 7 ; 1 ; 0 ; 0 n  (North American).
 1147 
 1148           The last two parameters apply to VT300 & up (keyboard ready)
 1149           and VT400 & up (LK01) respectively.
 1150 
 1151             Ps = 5 3  -> Report Locator status.  The response is CSI ? 5
 1152           3 n  Locator available, if compiled-in, or CSI ? 5 0 n  No
 1153           Locator, if not.
 1154             Ps = 5 5  -> Report Locator status.  The response is CSI ? 5
 1155           3 n  Locator available, if compiled-in, or CSI ? 5 0 n  No
 1156           Locator, if not.
 1157             Ps = 5 6  -> Report Locator type.  The response is CSI ? 5 7
 1158           ; 1 n  Mouse, if compiled-in, or CSI ? 5 7 ; 0 n  Cannot iden-
 1159           tify, if not.
 1160             Ps = 6 2  -> Report macro space (DECMSR).  The response is
 1161           CSI Pn *  { .
 1162             Ps = 6 3  -> Report memory checksum (DECCKSR).  The response
 1163           is DCS Pt ! x x x x ST .
 1164               Pt is the request id (from an optional parameter to the
 1165           request).
 1166               The x's are hexadecimal digits 0-9 and A-F.
 1167             Ps = 7 5  -> Report data integrity.  The response is CSI ? 7
 1168           0 n  (ready, no errors).
 1169             Ps = 8 5  -> Report multi-session configuration.  The
 1170           response is CSI ? 8 3 n  (not configured for multiple-session
 1171           operation).
 1172 
 1173 CSI > Ps p
 1174           Set resource value pointerMode.  This is used by xterm to
 1175           decide whether to hide the pointer cursor as the user types.
 1176 
 1177           Valid values for the parameter:
 1178             Ps = 0  -> never hide the pointer.
 1179             Ps = 1  -> hide if the mouse tracking mode is not enabled.
 1180             Ps = 2  -> always hide the pointer, except when leaving the
 1181           window.
 1182             Ps = 3  -> always hide the pointer, even if leaving/entering
 1183           the window.
 1184 
 1185           If no parameter is given, xterm uses the default, which is 1 .
 1186 
 1187 CSI ! p   Soft terminal reset (DECSTR), VT220 and up.
 1188 
 1189 CSI Pl ; Pc " p
 1190           Set conformance level (DECSCL), VT220 and up.
 1191 
 1192           The first parameter selects the conformance level.  Valid val-
 1193           ues are:
 1194             Pl = 6 1  -> level 1, e.g., VT100.
 1195             Pl = 6 2  -> level 2, e.g., VT200.
 1196             Pl = 6 3  -> level 3, e.g., VT300.
 1197             Pl = 6 4  -> level 4, e.g., VT400.
 1198             Pl = 6 5  -> level 5, e.g., VT500.
 1199 
 1200           The second parameter selects the C1 control transmission mode.
 1201           This is an optional parameter, ignored in conformance level 1.
 1202           Valid values are:
 1203             Pc = 0  -> 8-bit controls.
 1204             Pc = 1  -> 7-bit controls (DEC factory default).
 1205             Pc = 2  -> 8-bit controls.
 1206 
 1207           The 7-bit and 8-bit control modes can also be set by S7C1T and
 1208           S8C1T, but DECSCL is preferred.
 1209 
 1210 CSI Ps $ p
 1211           Request ANSI mode (DECRQM).  For VT300 and up, reply DECRPM is
 1212             CSI Ps; Pm$ y
 1213           where Ps is the mode number as in SM/RM, and Pm is the mode
 1214           value:
 1215             0 - not recognized
 1216             1 - set
 1217             2 - reset
 1218             3 - permanently set
 1219             4 - permanently reset
 1220 
 1221 CSI ? Ps $ p
 1222           Request DEC private mode (DECRQM).  For VT300 and up, reply
 1223           DECRPM is
 1224             CSI ? Ps; Pm$ y
 1225           where Ps is the mode number as in DECSET/DECSET, Pm is the
 1226           mode value as in the ANSI DECRQM.
 1227           Two private modes are read-only (i.e., 1 3  and 1 4 ), pro-
 1228           vided only for reporting their values using this control
 1229           sequence.  They correspond to the resources cursorBlink and
 1230           cursorBlinkXOR.
 1231 CSI # p
 1232 CSI Pm # p
 1233           Push video attributes onto stack (XTPUSHSGR), xterm.  This is
 1234           an alias for CSI # { , used to work around language limita-
 1235           tions of C#.
 1236 
 1237 CSI Ps q  Load LEDs (DECLL), VT100.
 1238             Ps = 0  -> Clear all LEDS (default).
 1239             Ps = 1  -> Light Num Lock.
 1240             Ps = 2  -> Light Caps Lock.
 1241             Ps = 3  -> Light Scroll Lock.
 1242             Ps = 2 1  -> Extinguish Num Lock.
 1243             Ps = 2 2  -> Extinguish Caps Lock.
 1244             Ps = 2 3  -> Extinguish Scroll Lock.
 1245 
 1246 CSI Ps SP q
 1247           Set cursor style (DECSCUSR), VT520.
 1248             Ps = 0  -> blinking block.
 1249             Ps = 1  -> blinking block (default).
 1250             Ps = 2  -> steady block.
 1251             Ps = 3  -> blinking underline.
 1252             Ps = 4  -> steady underline.
 1253             Ps = 5  -> blinking bar, xterm.
 1254             Ps = 6  -> steady bar, xterm.
 1255 
 1256 CSI Ps " q
 1257           Select character protection attribute (DECSCA).  Valid values
 1258           for the parameter:
 1259             Ps = 0  -> DECSED and DECSEL can erase (default).
 1260             Ps = 1  -> DECSED and DECSEL cannot erase.
 1261             Ps = 2  -> DECSED and DECSEL can erase.
 1262 
 1263 CSI # q   Pop video attributes from stack (XTPOPSGR), xterm.  This is an
 1264           alias for CSI # } , used to work around language limitations
 1265           of C#.
 1266 
 1267 CSI Ps ; Ps r
 1268           Set Scrolling Region [top;bottom] (default = full size of win-
 1269           dow) (DECSTBM), VT100.
 1270 
 1271 CSI ? Pm r
 1272           Restore DEC Private Mode Values.  The value of Ps previously
 1273           saved is restored.  Ps values are the same as for DECSET.
 1274 
 1275 CSI Pt ; Pl ; Pb ; Pr ; Ps $ r
 1276           Change Attributes in Rectangular Area (DECCARA), VT400 and up.
 1277             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1278             Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
 1279 
 1280 CSI s     Save cursor, available only when DECLRMM is disabled (SCOSC,
 1281           also ANSI.SYS).
 1282 
 1283 CSI Pl ; Pr s
 1284           Set left and right margins (DECSLRM), VT420 and up.  This is
 1285           available only when DECLRMM is enabled.
 1286 
 1287 CSI ? Pm s
 1288           Save DEC Private Mode Values.  Ps values are the same as for
 1289           DECSET.
 1290 
 1291 CSI Ps ; Ps ; Ps t
 1292           Window manipulation (from dtterm, as well as extensions by
 1293           xterm).  These controls may be disabled using the allowWin-
 1294           dowOps resource.
 1295 
 1296           xterm uses Extended Window Manager Hints (EWMH) to maximize
 1297           the window.  Some window managers have incomplete support for
 1298           EWMH.  For instance, fvwm, flwm and quartz-wm advertise sup-
 1299           port for maximizing windows horizontally or vertically, but in
 1300           fact equate those to the maximize operation.
 1301 
 1302           Valid values for the first (and any additional parameters)
 1303           are:
 1304             Ps = 1  -> De-iconify window.
 1305             Ps = 2  -> Iconify window.
 1306             Ps = 3 ;  x ;  y -> Move window to [x, y].
 1307             Ps = 4 ;  height ;  width -> Resize the xterm window to
 1308           given height and width in pixels.  Omitted parameters reuse
 1309           the current height or width.  Zero parameters use the dis-
 1310           play's height or width.
 1311             Ps = 5  -> Raise the xterm window to the front of the stack-
 1312           ing order.
 1313             Ps = 6  -> Lower the xterm window to the bottom of the
 1314           stacking order.
 1315             Ps = 7  -> Refresh the xterm window.
 1316             Ps = 8 ;  height ;  width -> Resize the text area to given
 1317           height and width in characters.  Omitted parameters reuse the
 1318           current height or width.  Zero parameters use the display's
 1319           height or width.
 1320             Ps = 9 ;  0  -> Restore maximized window.
 1321             Ps = 9 ;  1  -> Maximize window (i.e., resize to screen
 1322           size).
 1323             Ps = 9 ;  2  -> Maximize window vertically.
 1324             Ps = 9 ;  3  -> Maximize window horizontally.
 1325             Ps = 1 0 ;  0  -> Undo full-screen mode.
 1326             Ps = 1 0 ;  1  -> Change to full-screen.
 1327             Ps = 1 0 ;  2  -> Toggle full-screen.
 1328             Ps = 1 1  -> Report xterm window state.
 1329           If the xterm window is non-iconified, it returns CSI 1 t .
 1330           If the xterm window is iconified, it returns CSI 2 t .
 1331             Ps = 1 3  -> Report xterm window position.
 1332           Note: X Toolkit positions can be negative, but the reported
 1333           values are unsigned, in the range 0-65535.  Negative values
 1334           correspond to 32768-65535.
 1335           Result is CSI 3 ; x ; y t
 1336             Ps = 1 3 ;  2  -> Report xterm text-area position.
 1337           Result is CSI 3 ; x ; y t
 1338             Ps = 1 4  -> Report xterm text area size in pixels.
 1339           Result is CSI  4 ;  height ;  width t
 1340             Ps = 1 4 ;  2  -> Report xterm window size in pixels.
 1341           Normally xterm's window is larger than its text area, since it
 1342           includes the frame (or decoration) applied by the window man-
 1343           ager, as well as the area used by a scroll-bar.
 1344           Result is CSI  4 ;  height ;  width t
 1345             Ps = 1 5  -> Report size of the screen in pixels.
 1346           Result is CSI  5 ;  height ;  width t
 1347             Ps = 1 6  -> Report xterm character cell size in pixels.
 1348           Result is CSI  6 ;  height ;  width t
 1349             Ps = 1 8  -> Report the size of the text area in characters.
 1350           Result is CSI  8 ;  height ;  width t
 1351             Ps = 1 9  -> Report the size of the screen in characters.
 1352           Result is CSI  9 ;  height ;  width t
 1353             Ps = 2 0  -> Report xterm window's icon label.
 1354           Result is OSC  L  label ST
 1355             Ps = 2 1  -> Report xterm window's title.
 1356           Result is OSC  l  label ST
 1357             Ps = 2 2 ; 0  -> Save xterm icon and window title on stack.
 1358             Ps = 2 2 ; 1  -> Save xterm icon title on stack.
 1359             Ps = 2 2 ; 2  -> Save xterm window title on stack.
 1360             Ps = 2 3 ; 0  -> Restore xterm icon and window title from
 1361           stack.
 1362             Ps = 2 3 ; 1  -> Restore xterm icon title from stack.
 1363             Ps = 2 3 ; 2  -> Restore xterm window title from stack.
 1364             Ps >= 2 4  -> Resize to Ps lines (DECSLPP), VT340 and VT420.
 1365           xterm adapts this by resizing its window.
 1366 
 1367 CSI > Pm t
 1368           This xterm control sets one or more features of the title
 1369           modes.  Each parameter enables a single feature.
 1370             Ps = 0  -> Set window/icon labels using hexadecimal.
 1371             Ps = 1  -> Query window/icon labels using hexadecimal.
 1372             Ps = 2  -> Set window/icon labels using UTF-8.
 1373             Ps = 3  -> Query window/icon labels using UTF-8.  (See dis-
 1374           cussion of Title Modes)
 1375 
 1376 CSI Ps SP t
 1377           Set warning-bell volume (DECSWBV), VT520.
 1378             Ps = 0  or 1  -> off.
 1379             Ps = 2 , 3  or 4  -> low.
 1380             Ps = 5 , 6 , 7 , or 8  -> high.
 1381 
 1382 CSI Pt ; Pl ; Pb ; Pr ; Ps $ t
 1383           Reverse Attributes in Rectangular Area (DECRARA), VT400 and
 1384           up.
 1385             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1386             Ps denotes the attributes to reverse, i.e.,  1, 4, 5, 7.
 1387 
 1388 CSI u     Restore cursor (SCORC, also ANSI.SYS).
 1389 
 1390 CSI Ps SP u
 1391           Set margin-bell volume (DECSMBV), VT520.
 1392             Ps = 0 , 5 , 6 , 7 , or 8  -> high.
 1393             Ps = 1  -> off.
 1394             Ps = 2 , 3  or 4  -> low.
 1395 
 1396 CSI Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ v
 1397           Copy Rectangular Area (DECCRA), VT400 and up.
 1398             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1399             Pp denotes the source page.
 1400             Pt ; Pl denotes the target location.
 1401             Pp denotes the target page.
 1402 
 1403 CSI Ps $ w
 1404           Request presentation state report (DECRQPSR), VT320 and up.
 1405             Ps = 0  -> error.
 1406             Ps = 1  -> cursor information report (DECCIR).
 1407           Response is
 1408             DCS 1 $ u Pt ST
 1409           Refer to the VT420 programming manual, which requires six
 1410           pages to document the data string Pt,
 1411             Ps = 2  -> tab stop report (DECTABSR).
 1412           Response is
 1413             DCS 2 $ u Pt ST
 1414           The data string Pt is a list of the tab-stops, separated by
 1415           "/" characters.
 1416 
 1417 CSI Pt ; Pl ; Pb ; Pr ' w
 1418           Enable Filter Rectangle (DECEFR), VT420 and up.
 1419           Parameters are [top;left;bottom;right].
 1420           Defines the coordinates of a filter rectangle and activates
 1421           it.  Anytime the locator is detected outside of the filter
 1422           rectangle, an outside rectangle event is generated and the
 1423           rectangle is disabled.  Filter rectangles are always treated
 1424           as "one-shot" events.  Any parameters that are omitted default
 1425           to the current locator position.  If all parameters are omit-
 1426           ted, any locator motion will be reported.  DECELR always can-
 1427           cels any prevous rectangle definition.
 1428 
 1429 CSI Ps x  Request Terminal Parameters (DECREQTPARM).
 1430           if Ps is a "0" (default) or "1", and xterm is emulating VT100,
 1431           the control sequence elicits a response of the same form whose
 1432           parameters describe the terminal:
 1433             Ps -> the given Ps incremented by 2.
 1434             Pn = 1  <- no parity.
 1435             Pn = 1  <- eight bits.
 1436             Pn = 1  <- 2 8  transmit 38.4k baud.
 1437             Pn = 1  <- 2 8  receive 38.4k baud.
 1438             Pn = 1  <- clock multiplier.
 1439             Pn = 0  <- STP flags.
 1440 
 1441 CSI Ps * x
 1442           Select Attribute Change Extent (DECSACE), VT420 and up.
 1443             Ps = 0  -> from start to end position, wrapped.
 1444             Ps = 1  -> from start to end position, wrapped.
 1445             Ps = 2  -> rectangle (exact).
 1446 
 1447 CSI Pc ; Pt ; Pl ; Pb ; Pr $ x
 1448           Fill Rectangular Area (DECFRA), VT420 and up.
 1449             Pc is the character to use.
 1450             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1451 
 1452 CSI Ps # y
 1453           Select checksum extension (XTCHECKSUM), xterm.  The bits of Ps
 1454           modify the calculation of the checksum returned by DECRQCRA:
 1455             0  -> do not negate the result.
 1456             1  -> do not report the VT100 video attributes.
 1457             2  -> do not omit checksum for blanks.
 1458             3  -> omit checksum for cells not explicitly initialized.
 1459             4  -> do not mask cell value to 8 bits or ignore combining
 1460           characters.
 1461             5  -> do not mask cell value to 7 bits.
 1462 
 1463 CSI Pi ; Pg ; Pt ; Pl ; Pb ; Pr * y
 1464           Request Checksum of Rectangular Area (DECRQCRA), VT420 and up.
 1465           Response is
 1466           DCS Pi ! ~ x x x x ST
 1467             Pi is the request id.
 1468             Pg is the page number.
 1469             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1470             The x's are hexadecimal digits 0-9 and A-F.
 1471 
 1472 CSI Ps ; Pu ' z
 1473           Enable Locator Reporting (DECELR).
 1474           Valid values for the first parameter:
 1475             Ps = 0  -> Locator disabled (default).
 1476             Ps = 1  -> Locator enabled.
 1477             Ps = 2  -> Locator enabled for one report, then disabled.
 1478           The second parameter specifies the coordinate unit for locator
 1479           reports.
 1480           Valid values for the second parameter:
 1481             Pu = 0  or omitted -> default to character cells.
 1482             Pu = 1  <- device physical pixels.
 1483             Pu = 2  <- character cells.
 1484 
 1485 CSI Pt ; Pl ; Pb ; Pr $ z
 1486           Erase Rectangular Area (DECERA), VT400 and up.
 1487             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1488 
 1489 CSI Pm ' {
 1490           Select Locator Events (DECSLE).
 1491           Valid values for the first (and any additional parameters)
 1492           are:
 1493             Ps = 0  -> only respond to explicit host requests (DECRQLP).
 1494           This is default.  It also cancels any filter rectangle.
 1495             Ps = 1  -> report button down transitions.
 1496             Ps = 2  -> do not report button down transitions.
 1497             Ps = 3  -> report button up transitions.
 1498             Ps = 4  -> do not report button up transitions.
 1499 
 1500 CSI # {
 1501 CSI Pm # {
 1502           Push video attributes onto stack (XTPUSHSGR), xterm.  The
 1503           optional parameters correspond to the SGR encoding for video
 1504           attributes, except for colors (which do not have a unique SGR
 1505           code):
 1506             Ps = 1  -> Bold.
 1507             Ps = 2  -> Faint.
 1508             Ps = 3  -> Italicized.
 1509             Ps = 4  -> Underlined.
 1510             Ps = 5  -> Blink.
 1511             Ps = 7  -> Inverse.
 1512             Ps = 8  -> Invisible.
 1513             Ps = 9  -> Crossed-out characters.
 1514             Ps = 1 0  -> Foreground color.
 1515             Ps = 1 1  -> Background color.
 1516             Ps = 2 1  -> Doubly-underlined.
 1517 
 1518           If no parameters are given, all of the video attributes are
 1519           saved.  The stack is limited to 10 levels.
 1520 
 1521 CSI Pt ; Pl ; Pb ; Pr $ {
 1522           Selective Erase Rectangular Area (DECSERA), VT400 and up.
 1523             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1524 
 1525 CSI Pt ; Pl ; Pb ; Pr # |
 1526           Report selected graphic rendition (XTREPORTSGR), xterm.  The
 1527           response is an SGR sequence which contains the attributes
 1528           which are common to all cells in a rectangle.
 1529             Pt ; Pl ; Pb ; Pr denotes the rectangle.
 1530 
 1531 CSI Ps $ |
 1532           Select columns per page (DECSCPP), VT340.
 1533             Ps = 0  -> 80 columns, default if Ps omitted.
 1534             Ps = 8 0  -> 80 columns.
 1535             Ps = 1 3 2  -> 132 columns.
 1536 
 1537 CSI Ps ' |
 1538           Request Locator Position (DECRQLP).
 1539           Valid values for the parameter are:
 1540             Ps = 0 , 1 or omitted -> transmit a single DECLRP locator
 1541           report.
 1542 
 1543           If Locator Reporting has been enabled by a DECELR, xterm will
 1544           respond with a DECLRP Locator Report.  This report is also
 1545           generated on button up and down events if they have been
 1546           enabled with a DECSLE, or when the locator is detected outside
 1547           of a filter rectangle, if filter rectangles have been enabled
 1548           with a DECEFR.
 1549 
 1550             <- CSI Pe ; Pb ; Pr ; Pc ; Pp &  w
 1551 
 1552           Parameters are [event;button;row;column;page].
 1553           Valid values for the event:
 1554             Pe = 0  <- locator unavailable - no other parameters sent.
 1555             Pe = 1  <- request - xterm received a DECRQLP.
 1556             Pe = 2  <- left button down.
 1557             Pe = 3  <- left button up.
 1558             Pe = 4  <- middle button down.
 1559             Pe = 5  <- middle button up.
 1560             Pe = 6  <- right button down.
 1561             Pe = 7  <- right button up.
 1562             Pe = 8  <- M4 button down.
 1563             Pe = 9  <- M4 button up.
 1564             Pe = 1 0  <- locator outside filter rectangle.
 1565           The "button" parameter is a bitmask indicating which buttons
 1566           are pressed:
 1567             Pb = 0  <- no buttons down.
 1568             Pb & 1  <- right button down.
 1569             Pb & 2  <- middle button down.
 1570             Pb & 4  <- left button down.
 1571             Pb & 8  <- M4 button down.
 1572           The "row" and "column" parameters are the coordinates of the
 1573           locator position in the xterm window, encoded as ASCII deci-
 1574           mal.
 1575           The "page" parameter is not used by xterm.
 1576 
 1577 CSI Ps * |
 1578           Select number of lines per screen (DECSNLS), VT420 and up.
 1579 
 1580 CSI # }   Pop video attributes from stack (XTPOPSGR), xterm.  Popping
 1581           restores the video-attributes which were saved using XTPUSHSGR
 1582           to their previous state.
 1583 
 1584 CSI Pm ' }
 1585           Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
 1586 
 1587 CSI Pm ' ~
 1588           Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.
 1589 
 1590 
 1591 Operating System Commands
 1592 
 1593 OSC Ps ; Pt BEL
 1594 
 1595 OSC Ps ; Pt ST
 1596           Set Text Parameters.  For colors and font, if Pt is a "?", the
 1597           control sequence elicits a response which consists of the con-
 1598           trol sequence which would set the corresponding value.  The
 1599           dtterm control sequences allow you to determine the icon name
 1600           and window title.
 1601             Ps = 0  -> Change Icon Name and Window Title to Pt.
 1602             Ps = 1  -> Change Icon Name to Pt.
 1603             Ps = 2  -> Change Window Title to Pt.
 1604             Ps = 3  -> Set X property on top-level window.  Pt should be
 1605           in the form "prop=value", or just "prop" to delete the prop-
 1606           erty.
 1607             Ps = 4 ; c ; spec -> Change Color Number c to the color
 1608           specified by spec.  This can be a name or RGB specification as
 1609           per XParseColor.  Any number of c/spec pairs may be given.
 1610           The color numbers correspond to the ANSI colors 0-7, their
 1611           bright versions 8-15, and if supported, the remainder of the
 1612           88-color or 256-color table.
 1613 
 1614           If a "?" is given rather than a name or RGB specification,
 1615           xterm replies with a control sequence of the same form which
 1616           can be used to set the corresponding color.  Because more than
 1617           one pair of color number and specification can be given in one
 1618           control sequence, xterm can make more than one reply.
 1619 
 1620             Ps = 5 ; c ; spec -> Change Special Color Number c to the
 1621           color specified by spec.  This can be a name or RGB specifica-
 1622           tion as per XParseColor.  Any number of c/spec pairs may be
 1623           given.  The special colors can also be set by adding the maxi-
 1624           mum number of colors to these codes in an OSC 4  control:
 1625 
 1626               Pc = 0  <- resource colorBD (BOLD).
 1627               Pc = 1  <- resource colorUL (UNDERLINE).
 1628               Pc = 2  <- resource colorBL (BLINK).
 1629               Pc = 3  <- resource colorRV (REVERSE).
 1630               Pc = 4  <- resource colorIT (ITALIC).
 1631 
 1632             Ps = 6 ; c ; f -> Enable/disable Special Color Number c.
 1633           The second parameter tells xterm to enable the corresponding
 1634           color mode if nonzero, disable it if zero.  OSC 6  is the same
 1635           as OSC 1 0 6 .
 1636 
 1637           The 10 colors (below) which may be set or queried using 1 0
 1638           through 1 9  are denoted dynamic colors, since the correspond-
 1639           ing control sequences were the first means for setting xterm's
 1640           colors dynamically, i.e., after it was started.  They are not
 1641           the same as the ANSI colors (however, the dynamic text fore-
 1642           ground and background colors are used when ANSI colors are
 1643           reset using SGR 3 9  and 4 9 , respectively).  These controls
 1644           may be disabled using the allowColorOps resource.  At least
 1645           one parameter is expected for Pt.  Each successive parameter
 1646           changes the next color in the list.  The value of Ps tells the
 1647           starting point in the list.  The colors are specified by name
 1648           or RGB specification as per XParseColor.
 1649 
 1650           If a "?" is given rather than a name or RGB specification,
 1651           xterm replies with a control sequence of the same form which
 1652           can be used to set the corresponding dynamic color.  Because
 1653           more than one pair of color number and specification can be
 1654           given in one control sequence, xterm can make more than one
 1655           reply.
 1656 
 1657             Ps = 1 0  -> Change VT100 text foreground color to Pt.
 1658             Ps = 1 1  -> Change VT100 text background color to Pt.
 1659             Ps = 1 2  -> Change text cursor color to Pt.
 1660             Ps = 1 3  -> Change mouse foreground color to Pt.
 1661             Ps = 1 4  -> Change mouse background color to Pt.
 1662             Ps = 1 5  -> Change Tektronix foreground color to Pt.
 1663             Ps = 1 6  -> Change Tektronix background color to Pt.
 1664             Ps = 1 7  -> Change highlight background color to Pt.
 1665             Ps = 1 8  -> Change Tektronix cursor color to Pt.
 1666             Ps = 1 9  -> Change highlight foreground color to Pt.
 1667 
 1668             Ps = 4 6  -> Change Log File to Pt.  This is normally dis-
 1669           abled by a compile-time option.
 1670 
 1671             Ps = 5 0  -> Set Font to Pt.  These controls may be disabled
 1672           using the allowFontOps resource.  If Pt begins with a "#",
 1673           index in the font menu, relative (if the next character is a
 1674           plus or minus sign) or absolute.  A number is expected but not
 1675           required after the sign (the default is the current entry for
 1676           relative, zero for absolute indexing).
 1677 
 1678           The same rule (plus or minus sign, optional number) is used
 1679           when querying the font.  The remainder of Pt is ignored.
 1680 
 1681           A font can be specified after a "#" index expression, by
 1682           adding a space and then the font specifier.
 1683 
 1684           If the TrueType Fonts menu entry is set (the renderFont
 1685           resource), then this control sets/queries the faceName
 1686           resource.
 1687 
 1688             Ps = 5 1  -> reserved for Emacs shell.
 1689 
 1690             Ps = 5 2  -> Manipulate Selection Data.  These controls may
 1691           be disabled using the allowWindowOps resource.  The parameter
 1692           Pt is parsed as
 1693                Pc ; Pd
 1694           The first, Pc, may contain zero or more characters from the
 1695           set c , p , q , s , 0 , 1 , 2 , 3 , 4 , 5 , 6 , and 7 .  It is
 1696           used to construct a list of selection parameters for clip-
 1697           board, primary, secondary, select, or cut buffers 0 through 7
 1698           respectively, in the order given.  If the parameter is empty,
 1699           xterm uses s 0 , to specify the configurable primary/clipboard
 1700           selection and cut buffer 0.
 1701 
 1702           The second parameter, Pd, gives the selection data.  Normally
 1703           this is a string encoded in base64 (RFC-4648).  The data
 1704           becomes the new selection, which is then available for pasting
 1705           by other applications.
 1706 
 1707           If the second parameter is a ? , xterm replies to the host
 1708           with the selection data encoded using the same protocol.  It
 1709           uses the first selection found by asking successively for each
 1710           item from the list of selection parameters.
 1711 
 1712           If the second parameter is neither a base64 string nor ? ,
 1713           then the selection is cleared.
 1714 
 1715             Ps = 1 0 4 ; c -> Reset Color Number c.  It is reset to the
 1716           color specified by the corresponding X resource.  Any number
 1717           of c parameters may be given.  These parameters correspond to
 1718           the ANSI colors 0-7, their bright versions 8-15, and if sup-
 1719           ported, the remainder of the 88-color or 256-color table.  If
 1720           no parameters are given, the entire table will be reset.
 1721 
 1722             Ps = 1 0 5 ; c -> Reset Special Color Number c.  It is reset
 1723           to the color specified by the corresponding X resource.  Any
 1724           number of c parameters may be given.  These parameters corre-
 1725           spond to the special colors which can be set using an OSC 5
 1726           control (or by adding the maximum number of colors using an
 1727           OSC 4  control).
 1728 
 1729             Ps = 1 0 6 ; c ; f -> Enable/disable Special Color Number c.
 1730           The second parameter tells xterm to enable the corresponding
 1731           color mode if nonzero, disable it if zero.
 1732 
 1733               Pc = 0  <- resource colorBDMode (BOLD).
 1734               Pc = 1  <- resource colorULMode (UNDERLINE).
 1735               Pc = 2  <- resource colorBLMode (BLINK).
 1736               Pc = 3  <- resource colorRVMode (REVERSE).
 1737               Pc = 4  <- resource colorITMode (ITALIC).
 1738               Pc = 5  <- resource colorAttrMode (Override ANSI).
 1739 
 1740           The dynamic colors can also be reset to their default
 1741           (resource) values:
 1742             Ps = 1 1 0  -> Reset VT100 text foreground color.
 1743             Ps = 1 1 1  -> Reset VT100 text background color.
 1744             Ps = 1 1 2  -> Reset text cursor color.
 1745             Ps = 1 1 3  -> Reset mouse foreground color.
 1746             Ps = 1 1 4  -> Reset mouse background color.
 1747             Ps = 1 1 5  -> Reset Tektronix foreground color.
 1748             Ps = 1 1 6  -> Reset Tektronix background color.
 1749             Ps = 1 1 7  -> Reset highlight color.
 1750             Ps = 1 1 8  -> Reset Tektronix cursor color.
 1751             Ps = 1 1 9  -> Reset highlight foreground color.
 1752 
 1753             Ps = I  ; c -> Set icon to file.  Sun shelltool, CDE dtterm.
 1754           The file is expected to be XPM format, and uses the same
 1755           search logic as the iconHint resource.
 1756 
 1757             Ps = l  ; c -> Set window title.  Sun shelltool, CDE dtterm.
 1758 
 1759             Ps = L  ; c -> Set icon label.  Sun shelltool, CDE dtterm.
 1760 
 1761 
 1762 Privacy Message
 1763 
 1764 PM Pt ST  xterm implements no PM  functions; Pt is ignored.  Pt need not
 1765           be printable characters.
 1766 
 1767 
 1768 Alt and Meta Keys
 1769 
 1770 Many keyboards have keys labeled "Alt".  Few have keys labeled "Meta".
 1771 However, xterm's default translations use the Meta modifier.  Common
 1772 keyboard configurations assign the Meta modifier to an "Alt" key.  By
 1773 using xmodmap one may have the modifier assigned to a different key, and
 1774 have "real" alt and meta keys.  Here is an example:
 1775 
 1776      ! put meta on mod3 to distinguish it from alt
 1777      keycode 64 = Alt_L
 1778      clear mod1
 1779      add mod1 = Alt_L
 1780      keycode 115 = Meta_L
 1781      clear mod3
 1782      add mod3 = Meta_L
 1783 
 1784 
 1785 The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set)
 1786 can be used to control the way the Meta modifier applies to ordinary
 1787 keys unless the modifyOtherKeys resource is set:
 1788 
 1789 o   prefix a key with the ESC  character.
 1790 
 1791 o   shift the key from codes 0-127 to 128-255 by adding 128.
 1792 
 1793 When modifyOtherKeys is set, ordinary keys may be sent as escape
 1794 sequences:
 1795 
 1796 o   When modifyOtherKeys is set to 1, only the alt- and meta-modifiers
 1797     apply.  For example, alt-Tab sends CSI 2 7 ; 3 ; 9 ~ (the second
 1798     parameter is "3" for alt, and the third parameter is the ASCII value
 1799     of tab, "9").
 1800 
 1801 o   When modifyOtherKeys is set to 2, all of the modifiers apply.  For
 1802     example, shift-Tab sends CSI 2 7 ; 2 ; 9 ~ rather than CSI Z (the
 1803     second parameter is "2" for shift).
 1804 
 1805 The formatOtherKeys resource tells n  to change the format of the escape
 1806 sequences sent when modifyOtherKeys applies.  When modifyOtherKeys is
 1807 set to 1, for example alt-Tab sends CSI 9 ; 3 u (changing the order of
 1808 parameters).  One drawback to this format is that applications may con-
 1809 fuse it with CSI u  (restore-cursor).
 1810 
 1811 The xterm FAQ section
 1812 
 1813    How can my program distinguish control-I from tab?
 1814 
 1815 goes into greater detail on this topic.
 1816 
 1817 The table shows the result for a given character "x" with modifiers
 1818 according to the default translations with the resources set on or off.
 1819 This assumes altIsNotMeta is set:
 1820 
 1821        -----------------------------------------------------------
 1822        key          altSendsEscape   metaSendsEscape   result
 1823        -----------+----------------+-----------------+------------
 1824        x          | off            | off             | x
 1825        Meta-x     | off            | off             | shift
 1826        Alt-x      | off            | off             | shift
 1827        Alt+Meta-x | off            | off             | shift
 1828        x          | ON             | off             | x
 1829        Meta-x     | ON             | off             | shift
 1830        Alt-x      | ON             | off             | ESC  x
 1831        Alt+Meta-x | ON             | off             | ESC  shift
 1832        x          | off            | ON              | x
 1833        Meta-x     | off            | ON              | ESC  x
 1834        Alt-x      | off            | ON              | shift
 1835        Alt+Meta-x | off            | ON              | ESC  shift
 1836        x          | ON             | ON              | x
 1837        Meta-x     | ON             | ON              | ESC  x
 1838        Alt-x      | ON             | ON              | ESC  x
 1839        Alt+Meta-x | ON             | ON              | ESC  x
 1840        -----------+----------------+-----------------+------------
 1841 
 1842 
 1843 
 1844 PC-Style Function Keys
 1845 
 1846 If xterm does minimal translation of the function keys, it usually does
 1847 this with a PC-style keyboard, so PC-style function keys result.  Sun
 1848 keyboards are similar to PC keyboards.  Both have cursor and scrolling
 1849 operations printed on the keypad, which duplicate the smaller cursor and
 1850 scrolling keypads.
 1851 
 1852 X does not predefine NumLock (used for VT220 keyboards) or Alt (used as
 1853 an extension for the Sun/PC keyboards) as modifiers.  These keys are
 1854 recognized as modifiers when enabled by the numLock resource, or by the
 1855 "DECSET 1 0 3 5 " control sequence.
 1856 
 1857 The cursor keys transmit the following escape sequences depending on the
 1858 mode specified via the DECCKM escape sequence.
 1859 
 1860                   Key            Normal     Application
 1861                   -------------+----------+-------------
 1862                   Cursor Up    | CSI A    | SS3 A
 1863                   Cursor Down  | CSI B    | SS3 B
 1864                   Cursor Right | CSI C    | SS3 C
 1865                   Cursor Left  | CSI D    | SS3 D
 1866                   -------------+----------+-------------
 1867 
 1868 The home- and end-keys (unlike PageUp and other keys also on the 6-key
 1869 editing keypad) are considered "cursor keys" by xterm.  Their mode is
 1870 also controlled by the DECCKM escape sequence:
 1871 
 1872                     Key        Normal     Application
 1873                     ---------+----------+-------------
 1874                     Home     | CSI H    | SS3 H
 1875                     End      | CSI F    | SS3 F
 1876                     ---------+----------+-------------
 1877 
 1878 
 1879 The application keypad transmits the following escape sequences depend-
 1880 ing on the mode specified via the DECKPNM and DECKPAM escape sequences.
 1881 Use the NumLock key to override the application mode.
 1882 
 1883 Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are
 1884 supported by the program.
 1885 
 1886       Key              Numeric    Application   Terminfo   Termcap
 1887       ---------------+----------+-------------+----------+----------
 1888       Space          | SP       | SS3 SP      | -        | -
 1889       Tab            | TAB      | SS3 I       | -        | -
 1890       Enter          | CR       | SS3 M       | kent     | @8
 1891       PF1            | SS3 P    | SS3 P       | kf1      | k1
 1892       PF2            | SS3 Q    | SS3 Q       | kf2      | k2
 1893       PF3            | SS3 R    | SS3 R       | kf3      | k3
 1894       PF4            | SS3 S    | SS3 S       | kf4      | k4
 1895       * (multiply)   | *        | SS3 j       | -        | -
 1896       + (add)        | +        | SS3 k       | -        | -
 1897       , (comma)      | ,        | SS3 l       | -        | -
 1898       - (minus)      | -        | SS3 m       | -        | -
 1899       . (Delete)     | .        | CSI 3 ~     | -        | -
 1900       / (divide)     | /        | SS3 o       | -        | -
 1901       0 (Insert)     | 0        | CSI 2 ~     | -        | -
 1902       1 (End)        | 1        | SS3 F       | kc1      | K4
 1903       2 (DownArrow)  | 2        | CSI B       | -        | -
 1904       3 (PageDown)   | 3        | CSI 6 ~     | kc3      | K5
 1905       4 (LeftArrow)  | 4        | CSI D       | -        | -
 1906       5 (Begin)      | 5        | CSI E       | kb2      | K2
 1907       6 (RightArrow) | 6        | CSI C       | -        | -
 1908       7 (Home)       | 7        | SS3 H       | ka1      | K1
 1909       8 (UpArrow)    | 8        | CSI A       | -        | -
 1910       9 (PageUp)     | 9        | CSI 5 ~     | ka3      | K3
 1911       = (equal)      | =        | SS3 X       | -        | -
 1912       ---------------+----------+-------------+----------+----------
 1913 
 1914 They also provide 12 function keys, as well as a few other special-pur-
 1915 pose keys:
 1916 
 1917                        Key        Escape Sequence
 1918                        ---------+-----------------
 1919                        F1       | SS3 P
 1920                        F2       | SS3 Q
 1921                        F3       | SS3 R
 1922                        F4       | SS3 S
 1923                        F5       | CSI 1 5 ~
 1924                        F6       | CSI 1 7 ~
 1925                        F7       | CSI 1 8 ~
 1926                        F8       | CSI 1 9 ~
 1927                        F9       | CSI 2 0 ~
 1928                        F10      | CSI 2 1 ~
 1929                        F11      | CSI 2 3 ~
 1930                        F12      | CSI 2 4 ~
 1931                        ---------+-----------------
 1932 
 1933 
 1934 Note that F1 through F4 are prefixed with SS3 , while the other keys are
 1935 prefixed with CSI .  Older versions of xterm implement different escape
 1936 sequences for F1 through F4, with a CSI  prefix.  These can be activated
 1937 by setting the oldXtermFKeys resource.  However, since they do not cor-
 1938 respond to any hardware terminal, they have been deprecated.  (The DEC
 1939 VT220 reserves F1 through F5 for local functions such as Setup).
 1940 
 1941                        Key        Escape Sequence
 1942                        ---------+-----------------
 1943                        F1       | CSI 1 1 ~
 1944                        F2       | CSI 1 2 ~
 1945                        F3       | CSI 1 3 ~
 1946                        F4       | CSI 1 4 ~
 1947                        ---------+-----------------
 1948 
 1949 In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
 1950 false (and none of the other keyboard resources such as oldXtermFKeys
 1951 resource is set), xterm encodes function key modifiers as parameters
 1952 appended before the final character of the control sequence.  As a spe-
 1953 cial case, the SS3  sent before F1 through F4 is altered to CSI  when
 1954 sending a function key modifier as a parameter.
 1955 
 1956                     Code     Modifiers
 1957                   ---------+---------------------------
 1958                      2     | Shift
 1959                      3     | Alt
 1960                      4     | Shift + Alt
 1961                      5     | Control
 1962                      6     | Shift + Control
 1963                      7     | Alt + Control
 1964                      8     | Shift + Alt + Control
 1965                      9     | Meta
 1966                      10    | Meta + Shift
 1967                      11    | Meta + Alt
 1968                      12    | Meta + Alt + Shift
 1969                      13    | Meta + Ctrl
 1970                      14    | Meta + Ctrl + Shift
 1971                      15    | Meta + Ctrl + Alt
 1972                      16    | Meta + Ctrl + Alt + Shift
 1973                   ---------+---------------------------
 1974 
 1975 For example, shift-F5 would be sent as CSI 1 5 ; 2 ~
 1976 
 1977 If the alwaysUseMods resource is set, the Meta modifier also is recog-
 1978 nized, making parameters 9 through 16.
 1979 
 1980 The codes used for the PC-style function keys were inspired by a feature
 1981 of the VT510, referred to in its reference manual as DECFNK.  In the
 1982 DECFNK scheme, codes 2-8 identify modifiers for function-keys and cur-
 1983 sor-, editing-keypad keys.  Unlike xterm, the VT510 limits the modifiers
 1984 which can be used with cursor- and editing-keypad keys.  Although the
 1985 name "DECFNK" implies that it is a mode, the VT510 manual mentions it
 1986 only as a feature, which (like xterm) interacts with the DECUDK feature.
 1987 Unlike xterm, VT510/VT520 provide an extension to DECUDK (DECPFK and
 1988 DECPAK) which apparently was the reason for the feature in those termi-
 1989 nals, i.e., for identifying a programmable key rather than making it
 1990 simple for applications to obtain modifier information.  It is not
 1991 described in the related VT520 manual.  Neither manual was readily
 1992 available at the time the feature was added to xterm.
 1993 
 1994 On the other hand, the VT510 and VT520 reference manuals do document a
 1995 related feature.  That is its emulation of the SCO console, which is
 1996 similar to the "xterm-sco" terminal description.  The SCO console func-
 1997 tion-keys are less useful to applications developers than the approach
 1998 used by xterm because
 1999 
 2000 o   the relationship between modifiers and the characters sent by func-
 2001     tion-keys is not readily apparent, and
 2002 
 2003 o   the scheme is not extensible, i.e., it is an ad hoc assignment lim-
 2004     ited to two modifiers (shift and control).
 2005 
 2006 
 2007 VT220-Style Function Keys
 2008 
 2009 However, xterm is most useful as a DEC VT102 or VT220 emulator.  Set the
 2010 sunKeyboard resource to true to force a Sun/PC keyboard to act like a
 2011 VT220 keyboard.
 2012 
 2013 The VT102/VT220 application keypad transmits unique escape sequences in
 2014 application mode, which are distinct from the cursor and scrolling key-
 2015 pad:
 2016 
 2017             Key            Numeric    Application   VT100?
 2018             -------------+----------+-------------+----------
 2019             Space        | SP       | SS3 SP      | no
 2020             Tab          | TAB      | SS3 I       | no
 2021             Enter        | CR       | SS3 M       | yes
 2022             PF1          | SS3 P    | SS3 P       | yes
 2023             PF2          | SS3 Q    | SS3 Q       | yes
 2024             PF3          | SS3 R    | SS3 R       | yes
 2025             PF4          | SS3 S    | SS3 S       | yes
 2026             * (multiply) | *        | SS3 j       | no
 2027             + (add)      | +        | SS3 k       | no
 2028             , (comma)    | ,        | SS3 l       | yes
 2029             - (minus)    | -        | SS3 m       | yes
 2030             . (period)   | .        | SS3 n       | yes
 2031             / (divide)   | /        | SS3 o       | no
 2032             0            | 0        | SS3 p       | yes
 2033             1            | 1        | SS3 q       | yes
 2034             2            | 2        | SS3 r       | yes
 2035             3            | 3        | SS3 s       | yes
 2036             4            | 4        | SS3 t       | yes
 2037             5            | 5        | SS3 u       | yes
 2038             6            | 6        | SS3 v       | yes
 2039             7            | 7        | SS3 w       | yes
 2040             8            | 8        | SS3 x       | yes
 2041             9            | 9        | SS3 y       | yes
 2042             = (equal)    | =        | SS3 X       | no
 2043             -------------+----------+-------------+----------
 2044 
 2045 
 2046 The VT100/VT220 keypad did not have all of those keys.  They were imple-
 2047 mented in xterm in X11R1 (1987), defining a mapping of all X11 keys
 2048 which might be provided on a keypad.  For instance, a Sun4/II type-4
 2049 keyboard provided "=" (equal), "/" (divide), and "*" (multiply).
 2050 
 2051 While the VT420 provided the same keypad, the VT520 used a PC-keyboard.
 2052 Because that keyboard's keypad lacks the "," (comma), it was not possi-
 2053 ble to use EDT's delete-character function with the keypad.  XTerm
 2054 solves that problem for the VT220-keyboard configuration by mapping
 2055 
 2056   Ctrl +  to ,  and
 2057   Ctrl -  to -
 2058 
 2059 The VT220 provides a 6-key editing keypad, which is analogous to that on
 2060 the PC keyboard.  It is not affected by DECCKM or DECKPNM/DECKPAM:
 2061 
 2062                    Key        Normal     Application
 2063                    ---------+----------+-------------
 2064                    Insert   | CSI 2 ~  | CSI 2 ~
 2065                    Delete   | CSI 3 ~  | CSI 3 ~
 2066                    Home     | CSI 1 ~  | CSI 1 ~
 2067                    End      | CSI 4 ~  | CSI 4 ~
 2068                    PageUp   | CSI 5 ~  | CSI 5 ~
 2069                    PageDown | CSI 6 ~  | CSI 6 ~
 2070                    ---------+----------+-------------
 2071 
 2072 
 2073 The VT220 provides 8 additional function keys.  With a Sun/PC keyboard,
 2074 access these keys by Control/F1 for F13, etc.
 2075 
 2076                        Key        Escape Sequence
 2077                        ---------+-----------------
 2078                        F13      | CSI 2 5 ~
 2079                        F14      | CSI 2 6 ~
 2080                        F15      | CSI 2 8 ~
 2081                        F16      | CSI 2 9 ~
 2082                        F17      | CSI 3 1 ~
 2083                        F18      | CSI 3 2 ~
 2084                        F19      | CSI 3 3 ~
 2085                        F20      | CSI 3 4 ~
 2086                        ---------+-----------------
 2087 
 2088 
 2089 
 2090 VT52-Style Function Keys
 2091 
 2092 A VT52 does not have function keys, but it does have a numeric keypad
 2093 and cursor keys.  They differ from the other emulations by the prefix.
 2094 Also, the cursor keys do not change:
 2095 
 2096                    Key            Normal/Application
 2097                    -------------+--------------------
 2098                    Cursor Up    | ESC A
 2099                    Cursor Down  | ESC B
 2100                    Cursor Right | ESC C
 2101                    Cursor Left  | ESC D
 2102                    -------------+--------------------
 2103 
 2104 The keypad is similar:
 2105 
 2106             Key            Numeric    Application   VT52?
 2107             -------------+----------+-------------+----------
 2108             Space        | SP       | ESC ? SP    | no
 2109             Tab          | TAB      | ESC ? I     | no
 2110             Enter        | CR       | ESC ? M     | no
 2111             PF1          | ESC P    | ESC P       | yes
 2112             PF2          | ESC Q    | ESC Q       | yes
 2113             PF3          | ESC R    | ESC R       | yes
 2114             PF4          | ESC S    | ESC S       | no
 2115             * (multiply) | *        | ESC ? j     | no
 2116             + (add)      | +        | ESC ? k     | no
 2117             , (comma)    | ,        | ESC ? l     | no
 2118             - (minus)    | -        | ESC ? m     | no
 2119             . (period)   | .        | ESC ? n     | yes
 2120             / (divide)   | /        | ESC ? o     | no
 2121             0            | 0        | ESC ? p     | yes
 2122             1            | 1        | ESC ? q     | yes
 2123             2            | 2        | ESC ? r     | yes
 2124             3            | 3        | ESC ? s     | yes
 2125             4            | 4        | ESC ? t     | yes
 2126             5            | 5        | ESC ? u     | yes
 2127             6            | 6        | ESC ? v     | yes
 2128             7            | 7        | ESC ? w     | yes
 2129             8            | 8        | ESC ? x     | yes
 2130             9            | 9        | ESC ? y     | yes
 2131             = (equal)    | =        | ESC ? X     | no
 2132             -------------+----------+-------------+----------
 2133 
 2134 
 2135 
 2136 Sun-Style Function Keys
 2137 
 2138 The xterm program provides support for Sun keyboards more directly, by a
 2139 menu toggle that causes it to send Sun-style function key codes rather
 2140 than VT220.  Note, however, that the sun and VT100 emulations are not
 2141 really compatible.  For example, their wrap-margin behavior differs.
 2142 
 2143 Only function keys are altered; keypad and cursor keys are the same.
 2144 The emulation responds identically.  See the xterm-sun terminfo entry
 2145 for details.
 2146 
 2147 
 2148 HP-Style Function Keys
 2149 
 2150 Similarly, xterm can be compiled to support HP keyboards.  See the
 2151 xterm-hp terminfo entry for details.
 2152 
 2153 
 2154 The Alternate Screen Buffer
 2155 
 2156 XTerm maintains two screen buffers.  The Normal Screen Buffer allows you
 2157 to scroll back to view saved lines of output up to the maximum set by
 2158 the saveLines resource.  The Alternate Screen Buffer is exactly as large
 2159 as the display, contains no additional saved lines.  When the Alternate
 2160 Screen Buffer is active, you cannot scroll back to view saved lines.
 2161 XTerm provides control sequences and menu entries for switching between
 2162 the two.
 2163 
 2164 Most full-screen applications use terminfo or termcap to obtain strings
 2165 used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo,
 2166 or the corresponding ti and te for termcap.  The titeInhibit resource
 2167 removes the ti and te strings from the TERMCAP string which is set in
 2168 the environment for some platforms.  That is not done when xterm is
 2169 built with terminfo libraries because terminfo does not provide the
 2170 whole text of the termcap data in one piece.  It would not work for ter-
 2171 minfo anyway, since terminfo data is not passed in environment vari-
 2172 ables; setting an environment variable in this manner would have no
 2173 effect on the application's ability to switch between Normal and Alter-
 2174 nate Screen buffers.  Instead, the newer private mode controls (such as
 2175 1 0 4 9 ) for switching between Normal and Alternate Screen buffers sim-
 2176 ply disable the switching.  They add other features such as clearing the
 2177 display for the same reason: to make the details of switching indepen-
 2178 dent of the application that requests the switch.
 2179 
 2180 
 2181 Bracketed Paste Mode
 2182 
 2183 When bracketed paste mode is set, pasted text is bracketed with control
 2184 sequences so that the program can differentiate pasted text from typed-
 2185 in text.  When bracketed paste mode is set, the program will receive:
 2186    ESC [ 2 0 0 ~ ,
 2187 followed by the pasted text, followed by
 2188    ESC [ 2 0 1 ~ .
 2189 
 2190 
 2191 Title Modes
 2192 
 2193 The window- and icon-labels can be set or queried using control
 2194 sequences.  As a VT220-emulator, xterm "should" limit the character
 2195 encoding for the corresponding strings to ISO-8859-1.  Indeed, it used
 2196 to be the case (and was documented) that window titles had to be
 2197 ISO-8859-1.  This is no longer the case.  However, there are many appli-
 2198 cations which still assume that titles are set using ISO-8859-1.  So
 2199 that is the default behavior.
 2200 
 2201 If xterm is running with UTF-8 encoding, it is possible to use window-
 2202 and icon-labels encoded using UTF-8.  That is because the underlying X
 2203 libraries (and many, but not all) window managers support this feature.
 2204 
 2205 The utf8Title X resource setting tells xterm to disable a reconversion
 2206 of the title string back to ISO-8859-1, allowing the title strings to be
 2207 interpreted as UTF-8.  The same feature can be enabled using the title
 2208 mode control sequence described in this summary.
 2209 
 2210 Separate from the ability to set the titles, xterm provides the ability
 2211 to query the titles, returning them either in ISO-8859-1 or UTF-8.  This
 2212 choice is available only while xterm is using UTF-8 encoding.
 2213 
 2214 Finally, the characters sent to, or returned by a title control are less
 2215 constrained than the rest of the control sequences.  To make them more
 2216 manageable (and constrained), for use in shell scripts, xterm has an
 2217 optional feature which decodes the string from hexadecimal (for setting
 2218 titles) or for encoding the title into hexadecimal when querying the
 2219 value.
 2220 
 2221 
 2222 Mouse Tracking
 2223 
 2224 The VT widget can be set to send the mouse position and other informa-
 2225 tion on button presses.  These modes are typically used by editors and
 2226 other full-screen applications that want to make use of the mouse.
 2227 
 2228 There are two sets of mutually exclusive modes:
 2229 
 2230 o   mouse protocol
 2231 
 2232 o   protocol encoding
 2233 
 2234 The mouse protocols include DEC Locator mode, enabled by the DECELR CSI
 2235 Ps ; Ps '  z control sequence, and is not described here (control
 2236 sequences are summarized above).  The remaining five modes of the mouse
 2237 protocols are each enabled (or disabled) by a different parameter in the
 2238 "DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence.
 2239 
 2240 Manifest constants for the parameter values are defined in xcharmouse.h
 2241 as follows:
 2242 
 2243      #define SET_X10_MOUSE               9
 2244      #define SET_VT200_MOUSE             1000
 2245      #define SET_VT200_HIGHLIGHT_MOUSE   1001
 2246      #define SET_BTN_EVENT_MOUSE         1002
 2247      #define SET_ANY_EVENT_MOUSE         1003
 2248 
 2249      #define SET_FOCUS_EVENT_MOUSE       1004
 2250 
 2251      #define SET_EXT_MODE_MOUSE          1005
 2252      #define SET_SGR_EXT_MODE_MOUSE      1006
 2253      #define SET_URXVT_EXT_MODE_MOUSE    1015
 2254 
 2255      #define SET_ALTERNATE_SCROLL        1007
 2256 
 2257 The motion reporting modes are strictly xterm extensions, and are not
 2258 part of any standard, though they are analogous to the DEC VT200 DECELR
 2259 locator reports.
 2260 
 2261 Normally, parameters (such as pointer position and button number) for
 2262 all mouse tracking escape sequences generated by xterm encode numeric
 2263 parameters in a single character as value+32.  For example, !  specifies
 2264 the value 1.  The upper left character position on the terminal is
 2265 denoted as 1,1.  This scheme dates back to X10, though the normal mouse-
 2266 tracking (from X11) is more elaborate.
 2267 
 2268 
 2269 X10 compatibility mode
 2270 
 2271 X10 compatibility mode sends an escape sequence only on button press,
 2272 encoding the location and the mouse button pressed.  It is enabled by
 2273 specifying parameter 9 to DECSET.  On button press, xterm sends CSI M
 2274 CbCxCy (6 characters).
 2275 
 2276 o   Cb is button-1, where button is 1, 2 or 3.
 2277 
 2278 o   Cx and Cy are the x and y coordinates of the mouse when the button
 2279     was pressed.
 2280 
 2281 
 2282 Normal tracking mode
 2283 
 2284 Normal tracking mode sends an escape sequence on both button press and
 2285 release.  Modifier key (shift, ctrl, meta) information is also sent.  It
 2286 is enabled by specifying parameter 1000 to DECSET.  On button press or
 2287 release, xterm sends CSI M CbCxCy.
 2288 
 2289 o   The low two bits of Cb encode button information: 0=MB1 pressed,
 2290     1=MB2 pressed, 2=MB3 pressed, 3=release.
 2291 
 2292 o   The next three bits encode the modifiers which were down when the
 2293     button was pressed and are added together:  4=Shift, 8=Meta, 16=Con-
 2294     trol.  Note however that the shift and control bits are normally
 2295     unavailable because xterm uses the control modifier with mouse for
 2296     popup menus, and the shift modifier is used in the default transla-
 2297     tions for button events.  The Meta modifier recognized by xterm is
 2298     the mod1 mask, and is not necessarily the "Meta" key (see
 2299     xmodmap(1)).
 2300 
 2301 o   Cx and Cy are the x and y coordinates of the mouse event, encoded as
 2302     in X10 mode.
 2303 
 2304 
 2305 Wheel mice
 2306 
 2307 Wheel mice may return buttons 4 and 5.  Those buttons are represented by
 2308 the same event codes as buttons 1 and 2 respectively, except that 64 is
 2309 added to the event code.  Release events for the wheel buttons are not
 2310 reported.  By default, the wheel mouse events are translated to scroll-
 2311 back and scroll-forw actions.  Those actions normally scroll the whole
 2312 window, as if the scrollbar was used.  However if Alternate Scroll mode
 2313 is set, then cursor up/down controls are sent when the terminal is dis-
 2314 playing the Alternate Screen Buffer.  The initial state of Alternate
 2315 Scroll mode is set using the alternateScroll resource.
 2316 
 2317 
 2318 Other buttons
 2319 
 2320 Additional buttons are encoded like the wheel mice,
 2321 
 2322 o   by adding 64 (for buttons 6 and 7), or
 2323 
 2324 o   by adding 128 (for buttons 8 through 11).
 2325 
 2326 Past button 11, the encoding is ambiguous because the same code may cor-
 2327 respond to different button/modifier combinations.  It is not possible
 2328 to use these buttons (6-11) in xterm's translations resource because
 2329 their names are not in the X Toolkit's symbol table.
 2330 
 2331 
 2332 Highlight tracking
 2333 
 2334 Mouse highlight tracking notifies a program of a button press, receives
 2335 a range of lines from the program, highlights the region covered by the
 2336 mouse within that range until button release, and then sends the program
 2337 the release coordinates.  It is enabled by specifying parameter 1001 to
 2338 DECSET.  Highlighting is performed only for button 1, though other but-
 2339 ton events can be received.
 2340 
 2341 Warning: this mode requires a cooperating program, else xterm will hang.
 2342 
 2343 On button press, the same information as for normal tracking is gener-
 2344 ated; xterm then waits for the program to send mouse tracking informa-
 2345 tion.  All X events are ignored until the proper escape sequence is
 2346 received from the pty:
 2347 CSI Ps ; Ps ; Ps ; Ps ; Ps T
 2348 
 2349 The parameters are func, startx, starty, firstrow, and lastrow:
 2350 
 2351 o   func is non-zero to initiate highlight tracking and zero to abort.
 2352 
 2353 o   startx and starty give the starting x and y location for the high-
 2354     lighted region.
 2355 
 2356 o   The ending location tracks the mouse, but will never be above row
 2357     firstrow and will always be above row lastrow.  (The top of the
 2358     screen is row 1.)
 2359 
 2360 When the button is released, xterm reports the ending position one of
 2361 two ways:
 2362 
 2363 o   if the start and end coordinates are the same locations:
 2364 
 2365     CSI t CxCy
 2366 
 2367 o   otherwise:
 2368 
 2369     CSI T CxCyCxCyCxCy
 2370 
 2371 The parameters are startx, starty, endx, endy, mousex, and mousey:
 2372 
 2373 o   startx, starty, endx, and endy give the starting and ending charac-
 2374     ter positions of the region.
 2375 
 2376 o   mousex and mousey give the location of the mouse at button up, which
 2377     may not be over a character.
 2378 
 2379 
 2380 Button-event tracking
 2381 
 2382 Button-event tracking is essentially the same as normal tracking, but
 2383 xterm also reports button-motion events.  Motion events are reported
 2384 only if the mouse pointer has moved to a different character cell.  It
 2385 is enabled by specifying parameter 1002 to DECSET.  On button press or
 2386 release, xterm sends the same codes used by normal tracking mode.
 2387 
 2388 o   On button-motion events, xterm adds 32 to the event code (the third
 2389     character, Cb).
 2390 
 2391 o   The other bits of the event code specify button and modifier keys as
 2392     in normal mode.  For example, motion into cell x,y with button 1
 2393     down is reported as
 2394 
 2395     CSI M @ CxCy
 2396 
 2397     ( @  = 32 + 0 (button 1) + 32 (motion indicator) ).  Similarly,
 2398     motion with button 3 down is reported as
 2399 
 2400     CSI M B CxCy
 2401 
 2402     ( B  = 32 + 2 (button 3) + 32 (motion indicator) ).
 2403 
 2404 
 2405 Any-event tracking
 2406 
 2407 Any-event mode is the same as button-event mode, except that all motion
 2408 events are reported, even if no mouse button is down.  It is enabled by
 2409 specifying 1003 to DECSET.
 2410 
 2411 
 2412 FocusIn/FocusOut
 2413 
 2414 FocusIn/FocusOut can be combined with any of the mouse events since it
 2415 uses a different protocol.  When set, it causes xterm to send CSI I
 2416 when the terminal gains focus, and CSI O  when it loses focus.
 2417 
 2418 
 2419 Extended coordinates
 2420 
 2421 The original X10 mouse protocol limits the Cx and Cy ordinates to 223
 2422 (=255 - 32).  XTerm supports more than one scheme for extending this
 2423 range, by changing the protocol encoding:
 2424 
 2425 UTF-8 (1005)
 2426           This enables UTF-8 encoding for Cx and Cy under all tracking
 2427           modes, expanding the maximum encodable position from 223 to
 2428           2015.  For positions less than 95, the resulting output is
 2429           identical under both modes.  Under extended mouse mode, posi-
 2430           tions greater than 95 generate "extra" bytes which will con-
 2431           fuse applications which do not treat their input as a UTF-8
 2432           stream.  Likewise, Cb will be UTF-8 encoded, to reduce confu-
 2433           sion with wheel mouse events.
 2434 
 2435           Under normal mouse mode, positions outside (160,94) result in
 2436           byte pairs which can be interpreted as a single UTF-8 charac-
 2437           ter; applications which do treat their input as UTF-8 will
 2438           almost certainly be confused unless extended mouse mode is
 2439           active.
 2440 
 2441           This scheme has the drawback that the encoded coordinates will
 2442           not pass through luit(1) unchanged, e.g., for locales using
 2443           non-UTF-8 encoding.
 2444 
 2445 SGR (1006)
 2446           The normal mouse response is altered to use
 2447 
 2448           o   CSI < followed by semicolon-separated
 2449 
 2450           o   encoded button value,
 2451 
 2452           o   Px and Py ordinates and
 2453 
 2454           o   a final character which is M  for button press and m  for
 2455               button release.
 2456 
 2457           The encoded button value in this case does not add 32 since
 2458           that was useful only in the X10 scheme for ensuring that the
 2459           byte containing the button value is a printable code.
 2460 
 2461           o   The modifiers are encoded in the same way.
 2462 
 2463           o   A different final character is used for button release to
 2464               resolve the X10 ambiguity regarding which button was
 2465               released.
 2466 
 2467           The highlight tracking responses are also modified to an SGR-
 2468           like format, using the same SGR-style scheme and button-encod-
 2469           ings.
 2470 
 2471 URXVT (1015)
 2472           The normal mouse response is altered to use
 2473 
 2474           o   CSI followed by semicolon-separated
 2475 
 2476           o   encoded button value,
 2477 
 2478           o   the Px and Py ordinates and final character M .
 2479 
 2480           This uses the same button encoding as X10, but printing it as
 2481           a decimal integer rather than as a single byte.
 2482 
 2483           However, CSI M  can be mistaken for DL (delete lines), while
 2484           the highlight tracking CSI T  can be mistaken for SD (scroll
 2485           down), and the Window manipulation controls.  For these rea-
 2486           sons, the 1015 control is not recommended; it is not an
 2487           improvement over 1005.
 2488 
 2489 
 2490 Sixel Graphics
 2491 
 2492 If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the
 2493 decTerminalID resource, it supports Sixel Graphics controls, a palleted
 2494 bitmap graphics system using sets of six vertical pixels as the basic
 2495 element.
 2496 
 2497 CSI Ps c  Send Device Attributes (Primary DA), xterm.  xterm responds to
 2498           Send Device Attributes (Primary DA) with these additional
 2499           codes:
 2500             Ps = 4  -> Sixel graphics.
 2501 
 2502 CSI ? Pm h
 2503           Set Mode, xterm.  xterm has these additional private Set Mode
 2504           values:
 2505             Ps = 8 0  -> Sixel scrolling.
 2506             Ps = 1 0 7 0  -> use private color registers for each
 2507           graphic.
 2508             Ps = 8 4 5 2  -> Sixel scrolling leaves cursor to right of
 2509           graphic.
 2510 
 2511 DCS Pa ; Pb ; Ph q  Ps..Ps ST
 2512           Send SIXEL image, DEC graphics terminals, xterm.  See:
 2513 
 2514              VT330/VT340 Programmer Reference Manual Volume 2:
 2515              Graphics Programming
 2516              Chapter 14 Graphics Programming
 2517 
 2518           The sixel data device control string has three positional
 2519           parameters, following the q  with sixel data.
 2520             Pa -> pixel aspect ratio
 2521             Pb -> background color option
 2522             Ph -> horizontal grid size (ignored).
 2523             Ps -> sixel data
 2524 
 2525 
 2526 ReGIS Graphics
 2527 
 2528 If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the
 2529 decTerminalID resource, it supports Remote Graphic Instruction Set, a
 2530 graphics description language.
 2531 
 2532 CSI Ps c  Send Device Attributes (Primary DA), DEC graphics terminals,
 2533           xterm.  xterm responds to Send Device Attributes (Primary DA)
 2534           with these additional codes:
 2535             Ps = 3  -> ReGIS graphics.
 2536 
 2537 CSI ? Pm h
 2538           Set Mode, xterm.  xterm has these additional private Set Mode
 2539           values:
 2540             Ps = 1 0 7 0  -> use private color registers for each
 2541           graphic.
 2542 
 2543 DCS Pm p Pr..Pr ST
 2544           Enter or exit ReGIS, VT300, xterm.  See:
 2545 
 2546              VT330/VT340 Programmer Reference Manual Volume 2:
 2547              Graphics Programming
 2548              Chapter 1 Introduction to ReGIS
 2549 
 2550           The ReGIS data device control string has one positional param-
 2551           eter with four possible values:
 2552             Pm = 0 -> resume command, use fullscreen mode.
 2553             Pm = 1 -> start new command, use fullscreen mode.
 2554             Pm = 2 -> resume command, use command display mode.
 2555             Pm = 3 -> start new command, use command display mode.
 2556 
 2557 
 2558 Tektronix 4014 Mode
 2559 
 2560 Most of these sequences are standard Tektronix 4014 control sequences.
 2561 Graph mode supports the 12-bit addressing of the Tektronix 4014.  The
 2562 major features missing are the write-through and defocused modes.  This
 2563 document does not describe the commands used in the various Tektronix
 2564 plotting modes but does describe the commands to switch modes.
 2565 
 2566 Some of the sequences are specific to xterm.  The Tektronix emulation
 2567 was added in X10R4 (1986).  The VT240, introduced two years earlier,
 2568 also supported Tektronix 4010/4014.  Unlike xterm, the VT240 documenta-
 2569 tion implies (there is an obvious error in section 6.9 "Entering and
 2570 Exiting 4010/4014 Mode") that exiting back to ANSI mode is done by
 2571 resetting private mode 3 8  (DECTEK) rather than ESC ETX .  A real Tek-
 2572 tronix 4014 would not respond to either.
 2573 
 2574 BEL       Bell (Ctrl-G).
 2575 
 2576 BS        Backspace (Ctrl-H).
 2577 
 2578 TAB       Horizontal Tab (Ctrl-I).
 2579 
 2580 LF        Line Feed or New Line (Ctrl-J).
 2581 
 2582 VT        Cursor up (Ctrl-K).
 2583 
 2584 FF        Form Feed or New Page (Ctrl-L).
 2585 
 2586 CR        Carriage Return (Ctrl-M).
 2587 
 2588 ESC ETX   Switch to VT100 Mode (ESC  Ctrl-C).
 2589 
 2590 ESC ENQ   Return Terminal Status (ESC  Ctrl-E).
 2591 
 2592 ESC FF    PAGE (Clear Screen) (ESC  Ctrl-L).
 2593 
 2594 ESC SO    Begin 4015 APL mode (ESC  Ctrl-N).  This is ignored by xterm.
 2595 
 2596 ESC SI    End 4015 APL mode (ESC  Ctrl-O).  This is ignored by xterm.
 2597 
 2598 ESC ETB   COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss).
 2599             ETB  (end transmission block) is the same as Ctrl-W.
 2600 
 2601 ESC CAN   Bypass Condition (ESC  Ctrl-X).
 2602 
 2603 ESC SUB   GIN mode (ESC  Ctrl-Z).
 2604 
 2605 ESC FS    Special Point Plot Mode (ESC  Ctrl-\).
 2606 
 2607 ESC 8     Select Large Character Set.
 2608 
 2609 ESC 9     Select #2 Character Set.
 2610 
 2611 ESC :     Select #3 Character Set.
 2612 
 2613 ESC ;     Select Small Character Set.
 2614 
 2615 OSC Ps ; Pt BEL
 2616           Set Text Parameters of VT window.
 2617             Ps = 0  -> Change Icon Name and Window Title to Pt.
 2618             Ps = 1  -> Change Icon Name to Pt.
 2619             Ps = 2  -> Change Window Title to Pt.
 2620             Ps = 4 6  -> Change Log File to Pt.  This is normally dis-
 2621           abled by a compile-time option.
 2622 
 2623 ESC `     Normal Z Axis and Normal (solid) Vectors.
 2624 
 2625 ESC a     Normal Z Axis and Dotted Line Vectors.
 2626 
 2627 ESC b     Normal Z Axis and Dot-Dashed Vectors.
 2628 
 2629 ESC c     Normal Z Axis and Short-Dashed Vectors.
 2630 
 2631 ESC d     Normal Z Axis and Long-Dashed Vectors.
 2632 
 2633 ESC h     Defocused Z Axis and Normal (solid) Vectors.
 2634 
 2635 ESC i     Defocused Z Axis and Dotted Line Vectors.
 2636 
 2637 ESC j     Defocused Z Axis and Dot-Dashed Vectors.
 2638 
 2639 ESC k     Defocused Z Axis and Short-Dashed Vectors.
 2640 
 2641 ESC l     Defocused Z Axis and Long-Dashed Vectors.
 2642 
 2643 ESC p     Write-Thru Mode and Normal (solid) Vectors.
 2644 
 2645 ESC q     Write-Thru Mode and Dotted Line Vectors.
 2646 
 2647 ESC r     Write-Thru Mode and Dot-Dashed Vectors.
 2648 
 2649 ESC s     Write-Thru Mode and Short-Dashed Vectors.
 2650 
 2651 ESC t     Write-Thru Mode and Long-Dashed Vectors.
 2652 
 2653 FS        Point Plot Mode (Ctrl-\).
 2654 
 2655 GS        Graph Mode (Ctrl-]).
 2656 
 2657 RS        Incremental Plot Mode (Ctrl-^ ).
 2658 
 2659 US        Alpha Mode (Ctrl-_).
 2660 
 2661 
 2662 VT52 Mode
 2663 
 2664 Parameters for cursor movement are at the end of the ESC Y  escape
 2665 sequence.  Each ordinate is encoded in a single character as value+32.
 2666 For example, !  is 1.  The screen coordinate system is 0-based.
 2667 
 2668 ESC <     Exit VT52 mode (Enter VT100 mode).
 2669 
 2670 ESC =     Enter alternate keypad mode.
 2671 
 2672 ESC >     Exit alternate keypad mode.
 2673 
 2674 ESC A     Cursor up.
 2675 
 2676 ESC B     Cursor down.
 2677 
 2678 ESC C     Cursor right.
 2679 
 2680 ESC D     Cursor left.
 2681 
 2682 ESC F     Enter graphics mode.
 2683 
 2684 ESC G     Exit graphics mode.
 2685 
 2686 ESC H     Move the cursor to the home position.
 2687 
 2688 ESC I     Reverse line feed.
 2689 
 2690 ESC J     Erase from the cursor to the end of the screen.
 2691 
 2692 ESC K     Erase from the cursor to the end of the line.
 2693 
 2694 ESC Y Ps Ps
 2695           Move the cursor to given row and column.
 2696 
 2697 ESC Z     Identify.
 2698             -> ESC  /  Z  ("I am a VT52.").
 2699 
 2700 
 2701 Further reading
 2702 
 2703 
 2704 Technical manuals
 2705 
 2706 Manuals for hardware terminals are more readily available than simi-
 2707 larly-detailed documentation for terminal emulators such as aixterm,
 2708 shelltool, dtterm.
 2709 
 2710 However long, the technical manuals have problems:
 2711 
 2712 o   DEC's manuals did not provide a comprehensive comparison of the fea-
 2713     tures in different model.
 2714 
 2715     Peter Sichel's Host Interface Functions Checklist spreadsheet is
 2716     useful for noting which model introduced a given feature (although
 2717     there are a few apparent errors such as the DECRQSS feature cited
 2718     for VT320 whereas the technical manual omits it).
 2719 
 2720 o   Sometimes the manuals disagree.  For example, DEC's standard docu-
 2721     ment (DEC STD 070) for terminals says that DECSCL performs a soft
 2722     reset (DECSTR), while the VT420 manual says it does a hard reset
 2723     (RIS).
 2724 
 2725 o   Sometimes the manuals are simply incorrect.  For example, testing a
 2726     DEC VT420 in 1996 showed that the documented code for a valid or
 2727     invalid response to DECRQSS was reversed.
 2728 
 2729     The VT420 test results were incorporated into vttest program.  At
 2730     the time, DEC STD 070 was not available, but it also agrees with
 2731     vttest.  Later, documentation for the DEC VT525 was shown to have
 2732     the same flaw.
 2733 
 2734 o   Not all details are clear even in DEC STD 070 (which is more than
 2735     twice the length of the VT520 programmer's reference manual, and
 2736     almost three times longer than the VT420 reference manual).  How-
 2737     ever, as an internal standards document, DEC STD 070 is more likely
 2738     to describe the actual behavior of DEC's terminals than the more
 2739     polished user's guides.
 2740 
 2741 That said, here are technical manuals which have been used in developing
 2742 xterm.  Not all were available initially.  In August 1996 for instance,
 2743 the technical references were limited to EK-VT220-HR-002 and EK-
 2744 VT420-UG.002.  Shortly after, Richard Shuford sent a copy of EK-VT3XX-
 2745 TP-001.  Still later (beginning in 2003), Paul Williams' vt100.net site
 2746 provided EK-VT102-UG-003, EK-VT220-RM-002, EK-VT420-RM-002, EK-VT520-RM
 2747 A01, EK-VT100-TM-003, and EK-VT102-UG-003.  The remaining documents were
 2748 found on the bitsavers site.
 2749 
 2750 o   DECscope User's Manual.
 2751     Digital Equipment Corporation (EK-VT5X-OP-001 1975).
 2752 
 2753 o   VT100 Series Video Terminal Technical Manual.
 2754     Digital Equipment Corporation (EK-VT100-TM-003, July 1982).
 2755 
 2756 o   VT100 User Guide.
 2757     Digital Equipment Corporation (EK-VT100-UG-003, June 1981).
 2758 
 2759 o   VT102 User Guide.
 2760     Digital Equipment Corporation (EK-VT102-UG-003, February 1982).
 2761 
 2762 o   VT220 Programmer Pocket Guide.
 2763     Digital Equipment Corporation (EK-VT220-HR-002, July 1984).
 2764 
 2765 o   VT220 Programmer Reference Manual.
 2766     Digital Equipment Corporation (EK-VT220-RM-002, August 1984).
 2767 
 2768 o   VT240 Programmer Reference Manual.
 2769     Digital Equipment Corporation (EK-VT240-RM-002, October 1984).
 2770 
 2771 o   VT330/VT340 Programmer Reference Manual
 2772     Volume 1: Text Programming.
 2773     Digital Equipment Corporation (EK-VT3XX-TP-001, March 1987).
 2774 
 2775 o   VT330/VT340 Programmer Reference Manual
 2776     Volume 2: Graphics Programming.
 2777     Digital Equipment Corporation (EK-VT3XX-GP-001, March 1987).
 2778 
 2779 o   Installing and Using
 2780     The VT420 Video Terminal
 2781     (North American Model).
 2782     Digital Equipment Corporation (EK-VT420-UG.002, February 1990).
 2783 
 2784 o   VT420 Programmer Reference Manual.
 2785     Digital Equipment Corporation (EK-VT420-RM-002, February 1992).
 2786 
 2787 o   VT510 Video Terminal
 2788     Programmer Information.
 2789     Digital Equipment Corporation (EK-VT510-RM B01, November 1993).
 2790 
 2791 o   VT520/VT525 Video Terminal
 2792     Programmer Information.
 2793     Digital Equipment Corporation (EK-VT520-RM A01, July 1994).
 2794 
 2795 o   Digital ANSI-Compliant Printing Protocol
 2796     Level 2 Programming Reference Manual
 2797     Digital Equipment Corporation (EK-PPLV2-PM B01, August 1994).
 2798 
 2799 o   4014 and 4014-1 Computer Display Terminal
 2800     User's Manual.
 2801     Tektronix, Inc.  (070-1647-00, November 1979).
 2802 
 2803 
 2804 Standards
 2805 
 2806 The DEC terminal family (VT100 through VT525) is upward-compatible,
 2807 using standards plus extensions, e.g., "private modes".  Not all com-
 2808 monly-used features are standard.  For example, scrolling regions are
 2809 not found in ECMA-48.
 2810 
 2811 Again, it is possible to find discrepancies in the standards:
 2812 
 2813 o   The printed ECMA-48 5th edition (1991) and the first PDF produced
 2814     for that edition (April 1998) state that SD (scroll down) ends with
 2815     05/14, i.e., ^ , which disagrees with DEC's VT420 hardware implemen-
 2816     tation and DEC's manuals which use 05/04 T .  (A few other terminals
 2817     such as AT&T 5620 and IBM 5151 also used 05/04, but the documenta-
 2818     tion and dates are lacking).
 2819 
 2820     ECMA created a new PDF in April 2003 which changed that detail to
 2821     use T , and later in 2008 provided PDFs of the earlier editions
 2822     which used T .
 2823 
 2824 o   The VT320, VT420, VT520 manuals claim that DECSCL does a hard reset
 2825     (RIS).
 2826 
 2827     Both the VT220 manual and DEC STD 070 (which documents levels 1-4 in
 2828     detail) state that it is a soft reset, e.g., DECSTR.
 2829 
 2830 Here are the relevant standards:
 2831 
 2832 o   ECMA-35: Character Code Structure and Extension Techniques
 2833     (6th Edition, December 1994).
 2834 
 2835 o   ECMA-43: 8-bit Coded Character Set Structure and Rules
 2836     (3rd Edition, December 1991).
 2837 
 2838 o   ECMA-48: Control Functions for Coded Character Sets
 2839     (5th Edition, June 1991).
 2840 
 2841 o   DEC STD 070 Video Systems Reference Manual.
 2842     Digital Equipment Corporation (A-MN-ELSM070-00-0000 Rev H, December
 2843     3, 1991).
 2844 
 2845 
 2846 Miscellaneous
 2847 
 2848 A few hardware terminals survived into the 1990s only as terminal emula-
 2849 tors.  Documentation for these and other terminal emulators which have
 2850 influenced xterm are generally available only in less-accessible and
 2851 less-detailed manual pages.
 2852 
 2853 o   XTerm supports control sequences for manipulating its window which
 2854     were implemented by Sun's shelltool program.  This was part of Sun-
 2855     View (SunOS 3.0, 1986).  The change-notes for xterm's resize program
 2856     in X10.4 (1986) mention its use of these "Sun tty emulation escape
 2857     sequences" for resizing the window.  The X10.4 xterm program recog-
 2858     nized these sequences for resizing the terminal, except for the
 2859     iconfig/deiconfy pair.  SunView also introduced the SIGWINCH signal,
 2860     used by the X10.4 xterm and mentioned in its CHANGES file:
 2861 
 2862         The window size is passed to the operating system via TIOCSWINSZ
 2863         (4.3) or TIOCSSIZE (sun).  A SIGWINCH signal is sent if the
 2864         vtXXX window is resized.
 2865 
 2866     While support for the Sun control-sequences remained in resize, the
 2867     next release of xterm (X11R1 in 1987) omitted the code for inter-
 2868     preting them.
 2869 
 2870     Later, the SunView program was adapted for the OPEN LOOK environment
 2871     introduced 1988-1990.
 2872 
 2873     Still later, in 1995, OPEN LOOK was abandoned in favor of CDE.  The
 2874     CDE terminal emulator dtterm implemented those controls, with a cou-
 2875     ple of additions.
 2876 
 2877     Starting in July 1996, xterm re-implemented those control sequences
 2878     (based on the dtterm manual pages) and further extended the group of
 2879     window controls.
 2880 
 2881     There were two sets of controls (CSI Ps[ ; Pm ; Pm]t , and OSC
 2882     PstextST ) implemented by shelltool, documented in appendix E of
 2883     both PHIGS Programming Manual (1992), and the unpublished X Window
 2884     System User's Guide (OPEN LOOK Edition) (1995).  The CDE program
 2885     kept those, and added a few new ones.
 2886 
 2887     Code         Sun   CDE   XTerm   Description
 2888     -----------------------------------------------------------------
 2889     CSI 1 t      yes   yes    yes    de-iconify
 2890     CSI 2 t      yes   yes    yes    iconify
 2891     CSI 3 t      yes   yes    yes    move window to pixel-position
 2892     CSI 4 t      yes   yes    yes    resize window in pixels
 2893     CSI 5 t      yes   yes    yes    raise window to front of stack
 2894     CSI 6 t      yes   yes    yes    raise window to back of stack
 2895     CSI 7 t      yes   yes    yes    refresh window
 2896     CSI 8 t      yes   yes    yes    resize window in chars
 2897     CSI 9 t       -     -     yes    maximize/unmaximize window
 2898     CSI 1 0 t     -     -     yes    to/from full-screen
 2899     CSI 1 1 t    yes   yes    yes    report if window is iconified
 2900     CSI 1 2 t     -     -      -     -
 2901     CSI 1 3 t    yes   yes    yes    report window position
 2902     CSI 1 4 t    yes   yes    yes    report window size in pixels
 2903     CSI 1 5 t     -     -     yes    report screen size in pixels
 2904     CSI 1 6 t     -     -     yes    report character cell in pixels
 2905     CSI 1 7 t     -     -      -     -
 2906     CSI 1 8 t    yes   yes    yes    report window size in chars
 2907     CSI 1 9 t     -     -     yes    report screen size in chars
 2908     CSI 2 0 t     -    yes    yes    report icon label
 2909     CSI 2 1 t     -    yes    yes    report window title
 2910     CSI 2 2 t     -     -     yes    save window/icon title
 2911     CSI 2 3 t     -     -     yes    restore window/icon title
 2912     CSI 2 4 t     -     -     yes    resize window (DECSLPP)
 2913     OSC 0 ST      -    yes    yes    set window and icon title
 2914     OSC 1 ST      -    yes    yes    set icon label
 2915     OSC 2 ST      -    yes    yes    set window title
 2916     OSC 3 ST      -    n/a    yes    set X server property
 2917     OSC I ST     yes   yes    yes    set icon to file
 2918     OSC l ST     yes   yes    yes    set window title
 2919     OSC L ST     yes   yes    yes    set icon label
 2920 
 2921     Besides the Sun-derived OSC controls for setting window title and
 2922     icon label, dtterm also supported the xterm controls for the same
 2923     feature.
 2924 
 2925     The CDE source was unavailable for inspection until 2012, so that
 2926     clarification of the details of the window operations relied upon
 2927     vttest.
 2928 
 2929 o   The control sequences for saving/restoring the cursor and for sav-
 2930     ing/restoring "DEC Private Mode Values" may appear to be related
 2931     (since the "save" controls both end with s ), but that is coinciden-
 2932     tal.  The latter was introduced in X10.4:
 2933 
 2934         Most Dec Private mode settings can be save away internally using
 2935         \E[?ns, where n is the same number to set or reset the Dec
 2936         Private mode.  The mode can be restored using \E[?nr.  This can
 2937         be used in termcap for vi, for example, to turn off saving of
 2938         lines, but restore whatever the original state was on exit.
 2939 
 2940     while the SCOSC/SCORC pair was added in 1995 by XFree86  (and  docu-
 2941     mented long afterwards).
 2942 
 2943 o   The aixterm manual page gives the format of the control sequence for
 2944     foreground and background colors 8-15, but  does  not  specify  what
 2945     those  colors  are.  That is implied by the description's mention of
 2946     HFT:
 2947 
 2948         The aixterm command provides a standard terminal type for
 2949         programs that do not interact directly with Enhanced X-Windows.
 2950         This command provides an emulation for a VT102 terminal or a
 2951         high function terminal (HFT).  The VT102 mode is activated by
 2952         the -v flag.
 2953 
 2954     Unlike xterm, there are no resource names for the 16 colors, leaving
 2955     the  reader  to  assume that the mapping is hard-coded.  The control
 2956     sequences for colors 8-15 are not specified by ECMA-48,  but  rather
 2957     (as  done  in  other instances by xterm) chosen to not conflict with
 2958     current or future standards.