xterm.seq 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. Xterm Control Sequences
  2. Edward Moy
  3. University of California, Berkeley
  4. Revised by
  5. Stephen Gildea
  6. X Consortium
  7. Definitions
  8. c The literal character c.
  9. C A single (required) character.
  10. Ps A single (usually optional) numeric parameter, composed of one of more
  11. digits.
  12. Pm A multiple numeric parameter composed of any number of single numeric
  13. parameters, separated by ; character(s).
  14. Pt A text parameter composed of printable characters.
  15. VT100 Mode
  16. Most of these control sequences are standard VT102 control sequences, but
  17. there are some sequences here from later DEC VT terminals, too. VT102
  18. features not supported are smooth scrolling, double size characters, blink-
  19. ing characters, and VT52 mode. There are additional control sequences to
  20. provide xterm-dependent functions, like the scrollbar or window size. Where
  21. the function is specified by DEC or ISO 6429, the code assigned to it is
  22. given in parentheses. The escape codes to designate and invoke character
  23. sets are specified by ISO 2022; see that document for a discussion of char-
  24. acter sets.
  25. BEL Bell (Ctrl-G)
  26. BS Backspace (Ctrl-H)
  27. TAB Horizontal Tab (HT) (Ctrl-I)
  28. LF Line Feed or New Line (NL) (Ctrl-J)
  29. VT Vertical Tab (Ctrl-K) same as LF
  30. FF Form Feed or New Page (NP) (Ctrl-L) same as LF
  31. CR Carriage Return (Ctrl-M)
  32. SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set:
  33. invokes the G1 character set.
  34. SI Shift In (Ctrl-O) -> Switch to Standard Character Set:
  35. invokes the G0 character set (the default).
  36. ESC # 8 DEC Screen Alignment Test (DECALN)
  37. ESC ( C Designate G0 Character Set (ISO 2022)
  38. C = 0 -> DEC Special Character and Line Drawing Set
  39. C = A -> United Kingdom (UK)
  40. C = B -> United States (USASCII)
  41. ESC ) C Designate G1 Character Set (ISO 2022)
  42. C = 0 -> DEC Special Character and Line Drawing Set
  43. C = A -> United Kingdom (UK)
  44. C = B -> United States (USASCII)
  45. ESC * C Designate G2 Character Set (ISO 2022)
  46. C = 0 -> DEC Special Character and Line Drawing Set
  47. C = A -> United Kingdom (UK)
  48. C = B -> United States (USASCII)
  49. ESC + C Designate G3 Character Set (ISO 2022)
  50. C = 0 -> DEC Special Character and Line Drawing Set
  51. C = A -> United Kingdom (UK)
  52. C = B -> United States (USASCII)
  53. ESC 7 Save Cursor (DECSC)
  54. ESC 8 Restore Cursor (DECRC)
  55. ESC = Application Keypad (DECPAM)
  56. ESC > Normal Keypad (DECPNM)
  57. ESC D Index (IND)
  58. ESC E Next Line (NEL)
  59. ESC F Cursor to lower left corner of screen (if enabled by the
  60. hpLowerleftBugCompat resource).
  61. ESC H Tab Set (HTS)
  62. ESC M Reverse Index (RI)
  63. ESC N Single Shift Select of G2 Character Set (SS2): affects next
  64. character only
  65. ESC O Single Shift Select of G3 Character Set (SS3): affects next
  66. character only
  67. ESC P Pt ESC \ Device Control String (DCS)
  68. xterm implements no DCS functions; Pt is ignored. Pt need
  69. not be printable characters.
  70. ESC Z Return Terminal ID (DECID). Obsolete form of ESC [ c (DA).
  71. ESC [ Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH)
  72. ESC [ Ps A Cursor Up Ps Times (default = 1) (CUU)
  73. ESC [ Ps B Cursor Down Ps Times (default = 1) (CUD)
  74. ESC [ Ps C Cursor Forward Ps Times (default = 1) (CUF)
  75. ESC [ Ps D Cursor Backward Ps Times (default = 1) (CUB)
  76. ESC [ Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP)
  77. ESC [ Ps J Erase in Display (ED)
  78. Ps = 0 -> Clear Below (default)
  79. Ps = 1 -> Clear Above
  80. Ps = 2 -> Clear All
  81. ESC [ Ps K Erase in Line (EL)
  82. Ps = 0 -> Clear to Right (default)
  83. Ps = 1 -> Clear to Left
  84. Ps = 2 -> Clear All
  85. ESC [ Ps L Insert Ps Line(s) (default = 1) (IL)
  86. ESC [ Ps M Delete Ps Line(s) (default = 1) (DL)
  87. ESC [ Ps P Delete Ps Character(s) (default = 1) (DCH)
  88. ESC [ Ps ; Ps ; Ps ; Ps ; Ps T
  89. Initiate hilite mouse tracking. Parameters are
  90. [func;startx;starty;firstrow;lastrow]. See the section Mouse
  91. Tracking.
  92. ESC [ Ps c Send Device Attributes (DA)
  93. Ps = 0 or omitted -> request attributes from terminal
  94. -> ESC [ ? 1 ; 2 c (``I am a VT100 with Advanced Video
  95. Option.'')
  96. ESC [ Ps ; Ps f Horizontal and Vertical Position [row;column] (default =
  97. [1,1]) (HVP)
  98. ESC [ Ps g Tab Clear (TBC)
  99. Ps = 0 -> Clear Current Column (default)
  100. Ps = 3 -> Clear All
  101. ESC [ Pm h Set Mode (SM)
  102. Ps = 4 -> Insert Mode (IRM)
  103. Ps = 2 0 -> Automatic Newline (LNM)
  104. ESC [ Pm l Reset Mode (RM)
  105. Ps = 4 -> Replace Mode (IRM)
  106. Ps = 2 0 -> Normal Linefeed (LNM)
  107. ESC [ Pm m Character Attributes (SGR)
  108. Ps = 0 -> Normal (default)
  109. Ps = 1 -> Bold
  110. Ps = 4 -> Underscore
  111. Ps = 5 -> Blink (appears as Bold)
  112. Ps = 7 -> Inverse
  113. ESC [ Ps n Device Status Report (DSR)
  114. Ps = 5 -> Status Report ESC [ 0 n (``OK'')
  115. Ps = 6 -> Report Cursor Position (CPR) [row;column] as ESC
  116. [ r ; c R
  117. ESC [ Ps ; Ps r Set Scrolling Region [top;bottom] (default = full size of
  118. window) (DECSTBM)
  119. ESC [ Ps x Request Terminal Parameters (DECREQTPARM)
  120. ESC [ ? Pm h DEC Private Mode Set (DECSET)
  121. Ps = 1 -> Application Cursor Keys (DECCKM)
  122. Ps = 2 -> Designate USASCII for character sets G0-G3. (In
  123. the VT102, this selects VT52 mode (DECANM), which xterm
  124. doesn't support.)
  125. Ps = 3 -> 132 Column Mode (DECCOLM)
  126. Ps = 4 -> Smooth (Slow) Scroll (DECSCLM)
  127. Ps = 5 -> Reverse Video (DECSCNM)
  128. Ps = 6 -> Origin Mode (DECOM)
  129. Ps = 7 -> Wraparound Mode (DECAWM)
  130. Ps = 8 -> Auto-repeat Keys (DECARM)
  131. Ps = 9 -> Send Mouse X & Y on button press. See the sec-
  132. tion Mouse Tracking.
  133. Ps = 3 8 -> Enter Tektronix Mode (DECTEK)
  134. Ps = 4 0 -> Allow 80 <--> 132 Mode
  135. Ps = 4 1 -> more(1) fix (see curses resource)
  136. Ps = 4 4 -> Turn On Margin Bell
  137. Ps = 4 5 -> Reverse-wraparound Mode
  138. Ps = 4 6 -> Start Logging (normally disabled by a
  139. compile-time option)
  140. Ps = 4 7 -> Use Alternate Screen Buffer (unless disabled
  141. by the titeInhibit resource)
  142. Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
  143. release. See the section Mouse Tracking.
  144. Ps = 1 0 0 1 -> Use Hilite Mouse Tracking. See the sec-
  145. tion Mouse Tracking.
  146. ESC [ ? Pm l DEC Private Mode Reset (DECRST)
  147. Ps = 1 -> Normal Cursor Keys (DECCKM)
  148. Ps = 3 -> 80 Column Mode (DECCOLM)
  149. Ps = 4 -> Jump (Fast) Scroll (DECSCLM)
  150. Ps = 5 -> Normal Video (DECSCNM)
  151. Ps = 6 -> Normal Cursor Mode (DECOM)
  152. Ps = 7 -> No Wraparound Mode (DECAWM)
  153. Ps = 8 -> No Auto-repeat Keys (DECARM)
  154. Ps = 9 -> Don't Send Mouse X & Y on button press
  155. Ps = 4 0 -> Disallow 80 <--> 132 Mode
  156. Ps = 4 1 -> No more(1) fix (see curses resource)
  157. Ps = 4 4 -> Turn Off Margin Bell
  158. Ps = 4 5 -> No Reverse-wraparound Mode
  159. Ps = 4 6 -> Stop Logging (normally disabled by a compile-
  160. time option)
  161. Ps = 4 7 -> Use Normal Screen Buffer
  162. Ps = 1 0 0 0 -> Don't Send Mouse X & Y on button press and
  163. release
  164. Ps = 1 0 0 1 -> Don't Use Hilite Mouse Tracking
  165. ESC [ ? Pm r Restore DEC Private Mode Values. The value of Ps previously
  166. saved is restored. Ps values are the same as for DECSET.
  167. ESC [ ? Pm s Save DEC Private Mode Values. Ps values are the same as for
  168. DECSET.
  169. ESC ] Ps ; Pt BEL
  170. Set Text Parameters
  171. Ps = 0 -> Change Icon Name and Window Title to Pt
  172. Ps = 1 -> Change Icon Name to Pt
  173. Ps = 2 -> Change Window Title to Pt
  174. Ps = 4 6 -> Change Log File to Pt (normally disabled by a
  175. compile-time option)
  176. Ps = 5 0 -> Set Font to Pt
  177. ESC ^ Pt ESC \ Privacy Message (PM)
  178. xterm implements no PM functions; Pt is ignored. Pt need
  179. not be printable characters.
  180. ESC _ Pt ESC \ Application Program Command (APC)
  181. xterm implements no APC functions; Pt is ignored. Pt need
  182. not be printable characters.
  183. ESC c Full Reset (RIS)
  184. ESC l Memory Lock (per HP terminals). Locks memory above the cur-
  185. sor.
  186. ESC m Memory Unlock (per HP terminals)
  187. ESC n Invoke the G2 Character Set (LS2)
  188. ESC o Invoke the G3 Character Set (LS3)
  189. ESC | Invoke the G3 Character Set as GR (LS3R). Has no visible
  190. effect in xterm.
  191. ESC } Invoke the G2 Character Set as GR (LS2R). Has no visible
  192. effect in xterm.
  193. ESC ~ Invoke the G1 Character Set as GR (LS1R). Has no visible
  194. effect in xterm.
  195. Mouse Tracking
  196. The VT widget can be set to send the mouse position and other information on
  197. button presses. These modes are typically used by editors and other full-
  198. screen applications that want to make use of the mouse.
  199. There are three mutually exclusive modes, each enabled (or disabled) by a
  200. different parameter in the DECSET (or DECRST) escape sequence. Parameters
  201. for all mouse tracking escape sequences generated by xterm encode numeric
  202. parameters in a single character as value+040. For example, ! is 1. The
  203. screen coodinate system is 1-based.
  204. X10 compatibility mode sends an escape sequence on button press encoding the
  205. location and the mouse button pressed. It is enabled by specifying parame-
  206. ter 9 to DECSET. On button press, xterm sends ESC [ M CbCxCy (6 charac-
  207. ters). Cb is button-1. Cx and Cy are the x and y coordinates of the mouse
  208. when the button was pressed.
  209. Normal tracking mode sends an escape sequence on both button press and
  210. release. Modifier information is also sent. It is enabled by specifying
  211. parameter 1000 to DECSET. On button press or release, xterm sends ESC [ M
  212. CbCxCy. The low two bits of Cb encode button information: 0=MB1 pressed,
  213. 1=MB2 pressed, 2=MB3 pressed, 3=release. The upper bits encode what modif-
  214. iers were down when the button was pressed and are added together. 4=Shift,
  215. 8=Meta, 16=Control. Cx and Cy are the x and y coordinates of the mouse
  216. event. The upper left corner is (1,1).
  217. Mouse hilite tracking notifies a program of a button press, receives a range
  218. of lines from the program, highlights the region covered by the mouse within
  219. that range until button release, and then sends the program the release
  220. coordinates. It is enabled by specifying parameter 1001 to DECSET. Warn-
  221. ing: use of this mode requires a cooperating program or it will hang xterm.
  222. On button press, the same information as for normal tracking is generated;
  223. xterm then waits for the program to send mouse tracking information. All X
  224. events are ignored until the proper escape sequence is received from the
  225. pty: ESC [ Ps ; Ps ; Ps ; Ps ; Ps T . The parameters are func, startx,
  226. starty, firstrow, and lastrow. func is non-zero to initiate hilite tracking
  227. and zero to abort. startx and starty give the starting x and y location for
  228. the highlighted region. The ending location tracks the mouse, but will
  229. never be above row firstrow and will always be above row lastrow. (The top
  230. of the screen is row 1.) When the button is released, xterm reports the
  231. ending position one of two ways: if the start and end coordinates are valid
  232. text locations: ESC [ t CxCy. If either coordinate is past the end of the
  233. line: ESC [ T CxCyCxCyCxCy. The parameters are startx, starty, endx, endy,
  234. mousex, and mousey. startx, starty, endx, and endy give the starting and
  235. ending character positions of the region. mousex and mousey give the loca-
  236. tion of the mouse at button up, which may not be over a character.
  237. Tektronix 4014 Mode
  238. Most of these sequences are standard Tektronix 4014 control sequences.
  239. Graph mode supports the 12-bit addressing of the Tektronix 4014. The major
  240. features missing are the write-thru and defocused modes. This document does
  241. not describe the commands used in the various Tektronix plotting modes but
  242. does describe the commands to switch modes.
  243. BEL Bell (Ctrl-G)
  244. BS Backspace (Ctrl-H)
  245. TAB Horizontal Tab (Ctrl-I)
  246. LF Line Feed or New Line (Ctrl-J)
  247. VT Cursor up (Ctrl-K)
  248. FF Form Feed or New Page (Ctrl-L)
  249. CR Carriage Return (Ctrl-M)
  250. ESC ETX Switch to VT100 Mode (ESC Ctrl-C)
  251. ESC ENQ Return Terminal Status (ESC Ctrl-E)
  252. ESC FF PAGE (Clear Screen) (ESC Ctrl-L)
  253. ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N)
  254. ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O)
  255. ESC ETB COPY (Save Tektronix Codes to file COPYyy-mm-dd.hh:mm:ss)
  256. (ESC Ctrl-W)
  257. ESC CAN Bypass Condition (ESC Ctrl-X)
  258. ESC SUB GIN mode (ESC Ctrl-Z)
  259. ESC FS Special Point Plot Mode (ESC Ctrl-\)
  260. ESC 8 Select Large Character Set
  261. ESC 9 Select #2 Character Set
  262. ESC : Select #3 Character Set
  263. ESC ; Select Small Character Set
  264. ESC ] Ps ; Pt BEL
  265. Set Text Parameters of VT window
  266. Ps = 0 -> Change Icon Name and Window Title to Pt
  267. Ps = 1 -> Change Icon Name to Pt
  268. Ps = 2 -> Change Window Title to Pt
  269. Ps = 4 6 -> Change Log File to Pt (normally disabled by a
  270. compile-time option)
  271. ESC ` Normal Z Axis and Normal (solid) Vectors
  272. ESC a Normal Z Axis and Dotted Line Vectors
  273. ESC b Normal Z Axis and Dot-Dashed Vectors
  274. ESC c Normal Z Axis and Short-Dashed Vectors
  275. ESC d Normal Z Axis and Long-Dashed Vectors
  276. ESC h Defocused Z Axis and Normal (solid) Vectors
  277. ESC i Defocused Z Axis and Dotted Line Vectors
  278. ESC j Defocused Z Axis and Dot-Dashed Vectors
  279. ESC k Defocused Z Axis and Short-Dashed Vectors
  280. ESC l Defocused Z Axis and Long-Dashed Vectors
  281. ESC p Write-Thru Mode and Normal (solid) Vectors
  282. ESC q Write-Thru Mode and Dotted Line Vectors
  283. ESC r Write-Thru Mode and Dot-Dashed Vectors
  284. ESC s Write-Thru Mode and Short-Dashed Vectors
  285. ESC t Write-Thru Mode and Long-Dashed Vectors
  286. FS Point Plot Mode (Ctrl-\)
  287. GS Graph Mode (Ctrl-])
  288. RS Incremental Plot Mode (Ctrl-^)
  289. US Alpha Mode (Ctrl-_)