summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-27 18:20:06 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit594970f18dee92308fd1554663cc408cda4d102c (patch)
tree91fc75e94713a3de8327f680b01ccc8f53b755d9 /src/host_io.zig
parent6f7beca8d27e2e00f7b90bb75015637a9aa4c950 (diff)
downloadpardes-594970f18dee92308fd1554663cc408cda4d102c.tar.gz
pardes-594970f18dee92308fd1554663cc408cda4d102c.zip
Make pty/run and /log streams, and take refused lines back cleanly
Review fixes to pty/run and /log: - Both are streams with a per-open cursor. A shell's exec 3<>file shares one offset between write and read, so cat <&3 after echo make >&3 asked for offset 5 and got "0" instead of "exit 0"; log after follow lost its first bytes the same way. - A run is accepted only in pardes's own tagged input phase, so a nested shell's prompt (ssh, a shell with its own integration) is never taken for this shell's. - A line the shell refused is taken back so the next finds the prompt clear: bash's continuation prompt (now tagged k=c) gets Ctrl-C and the answer waits for the fresh prompt; a bash syntax error (no C, but a D) is answered at once; fish's kept line gets Ctrl-U (a Ctrl-C sent while fish redraws is lost). fish's right prompt no longer reads as typed input. - bash marks a command's start from PS0 on bash 4.4+, not a DEBUG trap, so a user's own DEBUG trap (bash-preexec, atuin) survives. bash's own job notices now show as in plain bash (ttyfollow golden). - 32 run slots; a new line on an open starts a fresh answer. Checked live in bash, fish, and fish with a right prompt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index fcd2225b..34c2f57a 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -589,8 +589,13 @@ pub const Shell = struct {
const bash_rc =
\\[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
\\PS1='\[\e]133;A;cl=line;aid=pardes\a\]'"$PS1"'\[\e]133;B;aid=pardes\a\]'
+ \\PS2='\[\e]133;A;k=c;aid=pardes\a\]'"$PS2"'\[\e]133;B;aid=pardes\a\]'
\\PROMPT_COMMAND='printf "\e]133;D;%s;aid=pardes\a" "$?"'"${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
- \\trap 'printf "\e]133;C;aid=pardes\a"' DEBUG
+ \\if ((BASH_VERSINFO[0] * 100 + BASH_VERSINFO[1] >= 404)); then
+ \\ PS0='\e]133;C;aid=pardes\a'"$PS0"
+ \\else
+ \\ trap 'printf "\e]133;C;aid=pardes\a"' DEBUG
+ \\fi
\\
;