The scroll region is a group of consecutive display rows that are treated as a scrolling region. The non-scrolling portion of the display can be above the scrolling region, below the scrolling region or both above and below the scrolling region. When the PropTerm is reset the current scroll region is set to the entire display.
The ANSI scroll control sequences operate on the area of the display currently set as the display scroll region.
For more information about the general syntax of the PropTerm ANSI control sequences see the ANSI Protocol page.
The symbol "CSI" will be used to indicate that either a seven bit or eight bit ANSI start sequence may be used.
The "n"symbol indicates a numeric parameter which is sent to the terminal as an ASCI decimal string.
Scroll Control Sequences
Set Scroll Region: CSI n;n r or CSI r
Set the first and last display row numbers for the current scroll region. The scroll region includes both the start and last row numbers. The valid range for a row number is from one to the number of rows. The first parameter is the decimal number of the start row of the scroll region. The second parameter is the last row number for the scroll region. Both parameters must be included. A special form of the control sequence with no parameters will set the scroll region to include all display rows.
Set Line Wrap On: CSI ?7h
Enables line wrap mode. When line wrap mode is on and the current cursor position is the last column of the display the next character written to the display will cause the the cursor to move to the first column of the next row.
If the current row is the last row of the scroll region the scroll region will be scrolled up one row and the current row will be cleared using the current background color. The next character will be displayed at the first column of the current row number. The row number will not change.
Set Line Wrap Off: CSI ?7l
Disables line wrap mode. if the cursor is positioned at the last column of the display the next character written to the display will overwrite the current character and the cursor will remain at the same position.
Scroll Up: CSI n S
Causes the entire scroll region to scroll up "n" rows. The lower scroll region rows will be cleared to the current background color. If the repeat parameter is not sent a value of one is assumed.
Scroll Down: CSI n T
Causes the entire scroll region to scroll down "n" rows. The upper scroll region rows will be cleared to the current background color. If the repeat parameter is not sent a value of one is assumed.
Insert Line: CSI n L
Insert a blank line at the cursor row. The cursor row must be in the current scroll region. The display rows from the cursor row to the second last row of the scroll region are copied to the next row down. The cursor row is cleared to the current background color. The cursor position is not changed. If the optional parameter is supplied then "n" blank lines will be inserted. If the repeat parameter is not supplied a repeat value of one is assumed.
Delete Line: CSI n M
Delete the line at the cursor row. The cursor row must be in the current scroll region. The display rows from the cursor row plus one to the last row of the scroll region are copied to the prior row. The last scroll region row is cleared to the current background color. The cursor position is not changed. If the optional parameter is supplied then "n" lines will be deleted. If the repeat parameter is not supplied a repeat value of one is assumed.
Insert Characters CSI n @
Insert "n" characters at the current column and row. The characters starting at the current column are shifted to the right by "n" characters. Characters at the end of the row do not wrap they are discarded. The inserted character are cleared to the current colors. The cursor position is not changed.
Delete Characters CSI n P
Delete "n" characters starting at the current column and row and shift the remaining characters to the left on the row. The characters starting at the current column plus the number of characters to delete are shifted to the left by "n" characters. The characters at the end of the current row are cleared to the current colors. The cursor position is not changed.
Scroll Control And Escape Codes
Go To Prior Row:
141 decimal, 8D hex, Esc M, "Reverse Index"
The cursor moves to the prior row and the column stays the same. If the current row is the first row of the current scroll region, the entire scroll region area will scroll down and the cursor will remain on the first row of the scroll region. If the current row is the first row of the display and not the first row of the scroll region the cursor will remain on the same row. The column position will not change.
Go To Next Row:
10 decimal, 0A hex, "Line Feed"
11 decimal, 0B hex, "Vertical Tab"
12 decimal, 0C hex, "Form Feed"
132 decimal, 84 hex, Esc D, "Index"
The cursor moves to the next row. If the current row is the last row of the current scroll region, the entire scroll region area will scroll up and the cursor will remain on the last row of the scroll region. If the current row is the last row of the display and not the last row of the scroll region the cursor will remain on the same row. The column position will not change.
Go To Next Row, First Column:
133 decimal, 85 hex, Esc E "New Line"
The cursor moves to the first column of the next row. If the current row is the last row of the current scroll region, the entire scroll region area will scroll up and the cursor will remain on the last row of the scroll region. If the current row is the last row of the display and not the last row of the scroll region the cursor will remain on the same row. The cursor is moved to the first column of the display.