⚠️You are viewing the website for the tip (nightly) version of Ghostty.Click here for the latest stable version.

Device Status Report (DSR)

Request information from the terminal.

  1. 0x1B
    ESC
  2. 0x5B
    [
  3. ____
    n
  4. 0x6E
    n

Request information from the terminal depending on the value of n.

The possible valid values of n are described in the paragraphs below. If any other value of n is provided, this sequence does nothing.

If n = 5, the operating status is requested. The terminal responds to the program with ESC [ 0 n to indicate no malfunctions.

If n = 6, the cursor position is requested. The terminal responds to the program in the format ESC [ y ; x R where y is the row and x is the column, both one-indexed. If origin mode (DEC Mode 6) is enabled, the reported cursor position is relative to the top-left of the scroll region.

Validation

DSR V-1: Operating Status

printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[5n"
|^[[0n_____|

DSR V-2: Cursor Position

printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[2;4H" # move to top-left
printf "\033[6n"
^[[2;4R