DECSED/DECSEL
AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard
DECSED (Selective Erase in Display) and DECSEL (Selective Erase in Line) are DEC private-mode variants of ED and EL that only erase characters not marked as protected by DECSCA.
Syntax
CSI ? Ps J DECSED — Selective Erase in Display
CSI ? Ps K DECSEL — Selective Erase in Line
Formal syntax
DECSED = 0x1b, "[", "?", [ Ps ], "J" ; DECSEL = 0x1b, "[", "?", [ Ps ], "K" ; Ps = "0" | "1" | "2" ; (* default: 0 *)
Parameters
| Value | Meaning |
|---|---|
0 | From cursor to end (default) |
1 | From beginning to cursor |
2 | Entire display/line |
Description
Per the VT510 manual, DECSED and DECSEL function identically to ED and EL respectively, but only erase characters that were written without the protected attribute. Characters marked as protected (by DECSCA — Select Character Protection Attribute) are left intact.
The ? prefix in the sequence distinguishes these from the standard ED (CSI J) and EL (CSI K).
This feature is used in forms-oriented applications where certain fields (labels, borders) should remain on screen while user-editable areas can be selectively cleared.
Examples
printf '\e[1"q' # DECSCA: mark subsequent chars as protected
printf 'Label: '
printf '\e[0"q' # DECSCA: mark subsequent chars as erasable
printf 'user input'
printf '\e[?2J' # DECSED: erase only unprotected characters
Specifications
| Specification | Section |
|---|---|
| VT510 Reference | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✗ | No | No evidence of selective erase implementation |
| Bobcat | ✓ | 0.9.0 | Supported via TerminalCtrl library |
| contour | ✓ | v0.3.5.238 | Includes DECSERA support |
| foot | ✗ | No | CSI ? J/K not implemented in csi.c:1469-1623 |
| Ghostty | ✓ | v1.0.0 | Protected mode support via CSI ? J/K |
| iTerm2 | ✓ | Yes | VT100CSI_DECSED and VT100CSI_DECSEL tokens parsed and executed via terminalSelectiveEraseInDisplay and terminalSelectiveEraseInLine |
| Kitty | ✗ | No | DECSED/DECSEL (CSI ? J/K) not supported. Private parameter parsed but DECSCA (character protection) not implemented |
| Konsole | ✗ | No | No DECSED/DECSEL implementation found; selective erase not supported |
| mintty | ✓ | Yes | DECSED (CSI ? J) at line 3182, DECSEL (CSI ? K) at line 3198, respects ATTR_PROTECTED attribute |
| mlterm | ✓ | rel-3_0_7 | Added in commit c45216f1 (2017-06-21); DECSED at vt_parser.c:4976-4998, DECSEL at 4999-5013 |
| PuTTY | ✗ | No | |
| Rio | ✗ | No | No evidence of selective erase implementation (CSI ? J/K) |
| rxvt-unicode | ✗ | No | Selective erase not implemented |
| st | ✗ | No | CSI ? J/K not implemented; ED/EL do not check private flag |
| terminology | ✗ | No | Explicitly unsupported, falls back to ED/EL |
| VT100 | ✗ | No | |
| VTE | ~ | Yes | Implemented but protected attribute not supported, behaves like ED/EL |
| WezTerm | ✗ | No | DECSED/DECSEL not implemented. SelectiveErase is advertised in device attributes but no CSI ? J/K sequences found |
| Windows Terminal | ✓ | Yes | DECSED at ITermDispatch.hpp:101, DECSEL at line 102. Both selective erase operations respect DECSCA protection. |
| xterm | ✓ | xterm-406 | |
| xterm.js | ✓ | 5.0.0 | Requires DECSCA to set protection attribute |
| Multiplexers | |||
| cy | ✗ | No | |
| GNU Screen | ✗ | No | CSI ? only handles h/l modes, not J/K |
| tmux | ✗ | No | Not implemented; DECSCA protection attribute not supported |
| tuios | ✗ | No | |
| Zellij | ✗ | No | |
See also
- ED — Erase in Display — Non-selective erase
- EL — Erase in Line — Non-selective line erase