^[control-codes
live in libghostty-vt

Control sequences

DL Delete Line

View as Markdown

Delete n lines at the cursor, pulling the lines below it up.

CSI Pn M
Defaults
Pn = 1
ECMA-48
§8.3.32 DL – Delete Line, p. 39
DEC STD 070
§5.11 Delete Line, p. 5-148
VT220
§4.11 Editing
VT510
DL—Delete Line

Delete Pn lines, starting with the line the cursor is on. The lines below them, up to the bottom margin, move up to close the gap, and blank lines appear at the bottom margin. A 0 is taken as 1, and asking for more lines than there are between the cursor and the bottom margin deletes only those.

As with IL, only the scrolling region is affected, the part of each line between the left and right margins if those are set, and DL does nothing if the cursor is outside the region. The VT510 manual adds that the new blank lines have no visual character attributes.

Afterwards the cursor is at the left margin of the line it was on, which is what DEC STD 070 specifies.

SU also moves lines up, but from the top of the scrolling region, wherever the cursor is.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§4.11 Editing
VT510manual, 1st ed., 1993YesDL
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMPartlyfails DL-5 of the 5 cases that show it working
foot1.28.0, run in a VMPartlyfails DL-5 of the 5 cases that show it working
pyte0.8.2, run as a libraryPartlyfails DL-5 of the 5 cases that show it working
xterm.js headless6.0.0, run as a libraryPartlyfails DL-5 of the 5 cases that show it working
alacritty_terminal0.26.0, run as a libraryPartlyfails DL-1, DL-5 of the 5 cases that show it working
ConEmubuild 230724, its documentationYesANSI escape codes
rxvt-unicode9.31, run in a VMPartlyfails DL-1, DL-2, DL-4, DL-5 of the 5 cases that show it working
VTE0.84.1, run as a libraryYespasses the 5 cases that show it working

Validation

DL-1: Delete one line

1\r\n2\r\n3\r\n4
\e[2;3H
\e[M
|1____|
|3____|
|4____|
|_____|
cursor 2,1

DL-2: More lines than there are

1\r\n2\r\n3\r\n4
\e[2;1H
\e[9M
|1____|
|_____|
|_____|
|_____|

DL-3: Only the scrolling region moves

1\r\n2\r\n3\r\n4
\e[1;3r   # region is lines 1 to 3; homes the cursor
\e[M
|2____|
|3____|
|_____|
|4____|

DL-4: Nothing happens outside the scrolling region

1\r\n2\r\n3\r\n4
\e[2;3r   # region is lines 2 and 3; homes the cursor, above it
\e[M
|1____|
|2____|
|3____|
|4____|
cursor 1,1

DL-5: Inside left and right margins

abcde\r\nfghij\r\nklmno\r\npqrst\r\nuvwxy
\e[?69h   # allow left and right margins
\e[2;4s   # margins at columns 2 and 4
\e[2;3H   # on the h
\e[M
|abcde|
|flmnj|
|kqrso|
|pvwxt|
|u___y|
cursor 2,2
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.