wire / terminal-dec-private-mode / 2004

DECSET 2004 — Bracketed paste mode

CSI ? 2004 h enables bracketed paste: when the user pastes, the terminal wraps the pasted text in ESC [ 2 0 0 ~ ... ESC [ 2 0 1 ~ so the application can tell pasted text from typed keystrokes and avoid executing it. CSI ? 2004 l disables it.

terminal-dec-private-mode kind control-sequence status de-facto verification verified tier B terminal-escape@1

aka: bracketed paste · bracketed paste mode · DECSET 2004 · ?2004h / ?2004l · paste guard

frame

DEC-private-mode introducer: \x1b[? ESC [ ? (0x1B 0x5B 0x3F)

terminator (none): ST · BEL

parameters / subcommands

idnamebytes (ST)meaning
set Enable (DECSET) \x1b[?2004h CSI ? 2004 h turns on bracketed paste. While enabled, when the user pastes, the terminal sends ESC [ 200~ before and ESC [ 201~ after the pasted bytes.
reset Disable (DECRST) \x1b[?2004l CSI ? 2004 l turns off bracketed paste; pasted text is then delivered as raw keystrokes with no wrappers.
paste-begin Paste-begin marker (terminal -> app) \x1b[200~ When bracketed paste is enabled, the terminal sends this BEFORE pasted content. The application reads it and treats subsequent bytes as literal data, not commands.
paste-end Paste-end marker (terminal -> app) \x1b[201~ The terminal sends this AFTER pasted content, signalling the end of the literal paste region.

gotchas


provenance

per-fact attribution:

see also

agent: curl -H 'accept: application/json' wire.phall.io/terminal-dec-private-mode/2004 or /terminal-dec-private-mode/2004.json