Skip to content

Cursor

The cursor is the active write position. Programs move it explicitly; characters output advance it implicitly.

Position

The cursor has a (row, column) position, 1-indexed. (1, 1) is the top-left of the active region.

Style

Selectable per program:

  • block — the default, fills the cell.
  • underline — a line at the cell baseline.
  • beam — a thin vertical line on the left edge.

Set with DECSCUSRCSI <n> SP q. User defaults via the cursor-style config key.

Each style has a blinking and a steady variant. DECSCUSR encodes both into the same parameter.

<n>Style
0, 1Block, blinking
2Block, steady
3Underline, blinking
4Underline, steady
5Beam, blinking
6Beam, steady

Blinking can also be toggled independently of the shape with DEC private mode 12 (CSI ? 12 h = blink, CSI ? 12 l = steady).

Whether a program's blink request is honored depends on the cursor-style-blink policy: the default_* values defer to the program, while always_* pin the blink and ignore both DECSCUSR's blink bit and DEC mode 12. The cursor shape always follows the program. See Cursor and Mouse and the cursor-style-blink reference.

A program can read the current cursor style back with DECRQSS: DCS $ q SP q ST → Otty replies DCS 1 $ r <n> SP q ST with the code from the table above.

Visibility

Show / hide with DEC private modes ?25h / ?25l. Hidden cursor is common in TUIs that draw their own.

Origin mode

DECOM (?6) makes CUP positions relative to the active scrolling region. Off by default.

See also

Otty