What
Adds bracketed-paste support to the interactive line editor.
Pasting multi-line text without bracketed paste is a classic footgun: each embedded newline submits a line, so a pasted block runs partially, line by line — often executing something the user hadn't reviewed. Den had no paste handling at all.
- Enable the mode (
ESC[?2004hon entry /ESC[?2004lon exit, via adeferso the terminal is always restored) so the terminal wraps pastes inESC[200~ … ESC[201~. - escape.zig: the CSI parameter parser only matched single-digit
ESC[N~sequences and returned.unknownfor anything longer — truncating200/201toESC[2and dumping the rest as literal input. Rewrote that arm to scan the full numeric parameter, returnnullwhile digits are still arriving, then map200~→paste_start,201~→paste_end(existing1/3/4/5/6andESC[1;5C/Dctrl-arrows preserved). - line_editor.zig:
handlePaste()reads up to the terminator via a small state machine and inserts the text in one batch (insertPasteByte, single redraw), normalizing embedded newline/CR/tab to spaces so the whole paste stays on one editable line and only runs on Enter.
Verification
zig buildclean (exit 0).- PTY test: pasting
echo LINE1\necho DANGER2bracketed byESC[200~/201~yields the single lineecho LINE1 echo DANGER2; nothing executes before Enter (nocommand not found, no standaloneDANGER2);ESC[?2004h/lemitted exactly once each.
Two files; additive; no API changes.