
The text is moved starting with the line the cursor is on. Also known as pan up, new lines fill in from the top of the screen Also known as pan down, new lines fill in from the bottom of the screen Scroll refers to which direction the text moves during the operation, not which way the viewport would seem to move. Viewport PositioningĪll commands in this section are generally equivalent to calling ScrollConsoleScreenBuffer console API to move the contents of the console buffer.Ĭaution The command names are misleading. The enable sequences end in a lowercase H character ( h) and the disable sequences end in a lowercase L character ( l). **With no parameters, performs a restore cursor operation like DECRC **With no parameters, performs a save cursor operation like DECSC *Cursor moves to coordinate within the viewport, where is the column of the line cannot be larger than 32,767 (maximum short value)Īll commands in this section are generally equivalent to calling the SetConsoleCursorPosition console API.Ĭursor moves to th position horizontally in the current lineĬursor moves to the th position vertically in the current column.If is omitted or equals 0, it will be treated as a 1.represents the distance to move and is an optional parameter.Each table below is grouped by functionality with notes below each table explaining how the group works.įor all parameters, the following rules apply unless otherwise noted: This will be represented by the shorthand. All CSI sequences start with ESC (0x1B) followed by [ (left bracket, 0x5B) and may contain parameters of variable length to specify more information for each operation. The following tables encompass Control Sequence Introducer (CSI) type sequences. The only way to access the saved value is with the restore command. **There will be no value saved in memory until the first use of the save command. * If there are scroll margins set, RI inside the margins will scroll only the contents of the margins, and leave the viewport unchanged. Reverse Index – Performs the reverse operation of \n, moves cursor up one line, maintains horizontal position, scrolls buffer if necessary* These sequences have no parameters and take effect immediately.Īll commands in this table are generally equivalent to calling the SetConsoleCursorPosition console API to place the cursor.Ĭursor movement will be bounded by the current viewport into the buffer. The following table describes simple escape sequences with a single action command directly after the ESC character. For an example of how these sequences are used in practice, please see the example at the end of this topic. No spaces are to be included in terminal sequences. In all of the following descriptions, ESC is always the hexadecimal value 0x1B. Note that the DISABLE_NEWLINE_AUTO_RETURN flag may also be useful in emulating the cursor positioning and scrolling behavior of other terminal emulators in relation to characters written to the final column in any row. The following terminal sequences are intercepted by the console host when written into the output stream, if the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag is set on the screen buffer handle using the SetConsoleMode function. More information about terminal sequences can be found at and at. The behavior of the following sequences is based on the VT100 and derived terminal emulator technologies, most specifically the xterm terminal emulator. A sample of the suggested way to enable virtual terminal behaviors is included at the end of this document. You can use GetConsoleMode and SetConsoleMode functions to configure this behavior. Sequences may also be received on the input stream in response to an output stream query information sequence or as an encoding of user input when the appropriate mode is set. Virtual terminal sequences are control character sequences that can control cursor movement, color/font mode, and other operations when written to the output stream.
