EL Erase in Line
Erase part or all of the cursor's line.
CSI Ps K
- Defaults
- Ps = 0
- ECMA-48
- §8.3.41 EL – Erase in Line, p. 42
- DEC STD 070
- §5.11 Erase in Line, p. 5-154
- VT220
- §4.12 Erasing
- VT510
- EL—Erase in Line
Erase some of the line the cursor is on, chosen by Ps:
Ps | Erases |
|---|---|
0 | from the cursor to the end of the line, the cursor’s cell included |
1 | from the start of the line to the cursor, the cursor’s cell included |
2 | the whole line |
The cursor does not move, and as with ED, erased cells take the current background color. CSI K is what a shell prints to clear the rest of a line it is redrawing.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | Yes | §4.12 Erasing |
| VT510 | manual, 1st ed., 1993 | Yes | EL |
| xterm | patch 412, xterm-411a | Yes | |
| libghostty-vt | 0f171f6 | Yes | |
| kitty | 0.49.1, run in a VM | Yes | passes the 3 cases that show it working |
| foot | 1.28.0, run in a VM | Yes | passes the 3 cases that show it working |
| pyte | 0.8.2, run as a library | Yes | passes the 3 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | Yes | passes the 3 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | Yes | passes the 3 cases that show it working |
| ConEmu | build 230724, its documentation | Yes | its list has 2 also move the cursor to the first column; ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | Yes | passes the 3 cases that show it working |
| VTE | 0.84.1, run as a library | Yes | passes the 3 cases that show it working |
Validation
EL-1: To the right
\e#8 # fill with E
\e[2;3H
\e[K
|EEEEE|
|EE___|
|EEEEE|
cursor 2,3
EL-2: To the left
\e#8 # fill with E
\e[2;3H
\e[1K
|EEEEE|
|___EE|
|EEEEE|
EL-3: The whole line
\e#8 # fill with E
\e[2;3H
\e[2K
|EEEEE|
|_____|
|EEEEE|
EL-4: With a background color
ABCDE
\e[1;3H
\e[41m # red background
\e[K
|AB___|
attr 1,2 bg=default
attr 1,3 bg=1
attr 1,5 bg=1