Files
tty7/crates
l0ng-aiandl0ng-ai 60ef3fb758 fix(shell): name the user, host and home in a Unix pwsh pane's title (#611)
The PowerShell integration read its identity from USERNAME, COMPUTERNAME and
USERPROFILE. Those three spellings exist only on Windows; on macOS and Linux
they come back empty, so every pwsh pane there was titled `@:` followed by a
full un-abbreviated path, and the `~` shortening never fired at all. Read them
through .NET instead, and take home from PowerShell's own $HOME, which is
correct everywhere.

Nothing gated this to Windows and nothing tested it off Windows either: every
pty round-trip in this module was `#[cfg(windows)]`, so a Windows-first script
shipped to two platforms it had never run on. Open the harness up to Unix and
give pwsh its own round-trip there.

That took two fixes to the harness. It typed at spawn time, which puts the
keystrokes ahead of the cursor-position reply in the same input stream — pwsh,
still waiting on that reply, eats `false\r` as the answer to its own query and
the command never runs; wait for the prompt-end mark before typing. And nothing
was answering `CSI 6n`, which PSReadLine blocks on before it will draw anything.
Enter comes in as a parameter now, because a raw-mode reader only accepts `\r`
where a line-discipline shell also takes `\n`.

While rewriting the home match: require the separator. With a home of
`/Users/ann` a bare StartsWith also swallowed `/Users/annex`, retitling it
`~ex`.

Found while investigating #583, which reports a pwsh pane freezing on `ls`.
This is not that bug — the injection runs clean on macOS pwsh 7.6.4 both over a
raw pty and under tmux — but it is a real defect on the same untested path.

Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
2026-08-13 12:14:49 +08:00
..