Commit Graph
1 Commits
Author SHA1 Message Date
3d7b306183 fix(terminal): submit startup commands with Enter on every platform (#23672)
* fix(terminal): submit startup commands with Enter on every platform

LF is Ctrl+J to a line editor, so a shell that remaps it left the command at the prompt.

Fixes #23250

Co-authored-by: Aashish Mahato <145881415+aashish254@users.noreply.github.com>

* test(terminal): expect CR in pty ipc startup tests

* fix(terminal): submit every line of a raw multiline startup command with CR

The CR switch only replaced the trailing terminator. On the raw path — a shell
with no bracketed paste, so each line break submits its own line — interior LFs
stayed LF, which is the same remappable Ctrl+J the fix set out to remove. A
multiline startup command in sh/dash/nushell/PowerShell therefore still stalled
partway through for a user who rebinds Ctrl+J. Normalise interior breaks to CR
on that path only; the bracketed-paste payload keeps its literal newlines.

* fix(terminal): quote multi-line PowerShell arguments on one line

A multi-line agent prompt was quoted as a single-quoted PowerShell string
with raw line breaks. Typed into Windows PowerShell 5.1 without PSReadLine,
each break submits a line and the shell waits at `>>` forever. Values with
CR/LF now become one double-quoted line with backtick escapes, keeping every
byte; single-line values keep the single-quoted form unchanged.

* style(terminal): keep typographic quotes as \u escapes in PowerShell quoting

Restores the escape form the single-quoted regex used on main and applies
it to the new double-quoted regex and the native argv test, so the diff
against main stays minimal and the characters are visible in review.

---------

Co-authored-by: Aashish Mahato <145881415+aashish254@users.noreply.github.com>
Co-authored-by: Neil <neil@stably.ai>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-10-05 16:20:15 -07:00