Micro Vibe

My Micro Hobby Projects

  • Increase font size
  • Default font size
  • Decrease font size
Home PropTerm Documents Cursor Control

Cursor Control

Print

 

The cursor is used as a reference to the user as to where the active character on the terminal display is located.  The cursor is also used as a reference for many ANSI control sequences that alter a line or character on the display.  In general ANSI cursor control commands do not alter the displayed information they are only used to position the cursor to a desired location on the display.

 

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.

Cursor Control Sequences

Prior RowCSI n A

Move the cursor to the prior display row. The display is not scrolled and the column position is not changed. The command accepts one parameter that indicates the number of rows to move. If the parameter is not sent a value of one is assumed.

Next RowCSI n B

Move the cursor to the next display row. The display is not scrolled and the column position is not changed. The command accepts one parameter that indicates the number of rows to move. If the parameter is not sent a value of one is assumed

Prior ColumnCSI n C

Move the cursor to the next display column. The display is not scrolled and the row position is not changed. The command accepts one parameter that indicates the number of columns to move. If the parameter is not sent a value of one is assumed.

Next Column:  CSI n D

Move the cursor to the prior display column. The display will not be scrolled and the row position is not changed. The command accepts one parameter that indicates the number of columns to move. If the parameter is not sent a value of one is assumed.

Prior Row, First ColumnCSI n F

Move the cursor to the first column on the prior display row. The display is not scrolled. The command accepts one parameter that indicates the number of rows to move. If the parameter is not sent a value of one is assumed.

Next Row, First ColumnCSI n E

Move the cursor to first column on the next display row. The display is not scrolled. The command accepts one parameter that indicates the number of rows to move. If the parameter is not sent a value of one is assumed

Go To Column:  CSI n G

Move the cursor to the specified display column. The display row position is not changed. The command accepts one parameter that indicates the column to move to.  Valid values for the column range from one to the number of columns. If the parameter is not sent a value of one is assumed.

Go To Row:  CSI n d

Move the cursor to the specified display row. The display column position is not changed. The command accepts one parameter that indicates the row to move to.  Valid values for the row range from one to the number of display rows. If the parameter is not sent a value of one is assumed.

Go To Row And Column:  CSI n;n H  or  CSI n;n f

Move the cursor to the specified display row and column. The command accepts two parameters that indicates the row and column to move to.  Valid values for the row range from one to the number of display rows. Valid values for the column range from one to the number of columns. If any of the two parameters are not sent a value of one is assumed for any missing parameters.

Report Row And Column:  CSI n

The current cursor column and row are returned as an ANSI control sequence.  The first parameter is the cursor row and the second parameter is the cursor column number. The cursor position sequence end with an ANSI "G" character (ESC [ row,column G).

Go To Next Horizontal Tab:  CSI n I

The cursor position is moved ahead "n" tab stops on the same row from the current column position. The control sequence takes a single parameter that specifies the number of tab stops to move. If the parameter is missing a value of one is assumed. As with the tab control character If there is no tab stop past the current column the cursor will not move. This command will not line wrap to the next row even when auto line wrap is enabled.

Go To Prior Horizontal Tab:  CSI n Z

The cursor position is moved back "n" tab stops on the same row from the current column position. The control sequence takes a single parameter that specifies the number of tab stops to move. If the parameter is missing a value of one is assumed. If there is no tab stop before the current column the cursor will not move. This command will not reverse line wrap to the prior row even when auto line wrap is enabled.

Clear Horizontal Tab Stop:  CSI g  or CSI 0g

The current cursor column is set to not be a tab stop. Tab stops apply to all the rows on the screen not only the current row.

Clear All Horizontal Tab Stops:   CSI 3g

The display columns are all set to not be a tab stops. Tab stops apply to all the rows on the screen not only the current row.

 Save Cursor:  CSI s

The current cursor position is saved. Use the restore cursor control sequence to restore the saved cursor position. Only one cursor position can be saved at a time.

Restore Cursor:  CSI u

The last saved cursor position is restored. Use the save cursor control sequence to save the current cursor position. Only one cursor position can be saved at a time.

Show Cursor:  CSI ?25h

Make the cursor visible if it is hidden by the hide cursor command.

Hide Cursor:  CSI ?25l

Set the cursor position to not display on the terminal screen.

Cursor Control And Escape Codes

 

Go To First Column:

13 decimal, 0D hex, "Carriage Return"

Move the cursor to the first column of the current row.

Go To Prior Column:

8 decimal, 08 hex, "Back Space"

Move the cursor to the prior column of the current row if not already at the first column.

Set Horizontal Tab Stop:

136 decimal, 85 hex, Esc H

The current cursor column position is set as a valid horizontal tab stop position.  Tab stops apply to all the rows on the screen not only the current row.

Go To Next Horizontal Tab Stop:

9 decimal, 09 hex "Tab"

The cursor moves forward to the next tab stop on the current row. If there is no tab stop past the current column the cursor will not move. This command will not line wrap to the next row even when auto line wrap is enabled.

 

 

Last Updated on Thursday, 25 July 2013 09:02