summaryrefslogtreecommitdiff
path: root/src/terminal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 04:57:43 -0300
committerGabriel Schneider <[email protected]>2026-10-01 04:57:43 -0300
commit0c3cf0628adf9e22270b09d9c451b08ac07f558a (patch)
treec8034581e1c465056a5e5e32cb0fd15242178674 /src/terminal.zig
parent2488df529cde2994c37f385cefca4db1837ed9a3 (diff)
downloadpardes-0c3cf0628adf9e22270b09d9c451b08ac07f558a.tar.gz
pardes-0c3cf0628adf9e22270b09d9c451b08ac07f558a.zip
A shell's prompt drawn on the alternate screen is a prompt: a terminal whose program was killed there is no longer busy for ever
htop killed with `sig KILL` leaves the emulator on its alternate screen; bash comes back and draws its prompt there, marks and all, but promptInputReady refused any prompt on the alternate screen, so pty/status said busy 1 and pty/run answered a bare `busy` for good. A prompt mark there now counts. A run sent at such a prompt leaves the alternate screen in the emulator first, as a reused command pane does, so its output lands on the primary screen and is read whole, not `exit 0 cut` with nothing. Busy there with no prompt drawn, and no program name to give, a run is told `busy alternate screen`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/terminal.zig')
-rw-r--r--src/terminal.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/terminal.zig b/src/terminal.zig
index a0337ce7..b7872d4e 100644
--- a/src/terminal.zig
+++ b/src/terminal.zig
@@ -1149,11 +1149,13 @@ pub fn greeting(pane: *const Pane) enum { wait, now, never } {
return if (promptInputEmpty(pane)) .now else .never;
}
+/// At a prompt's input: on the alternate screen too, where a program killed
+/// there (htop, `sig KILL`) left the emulator and the shell then drew its
+/// prompt, marks and all. A full-screen program draws no prompt marks.
pub fn promptInputReady(pane: *const Pane) bool {
if (comptime !enabled) return false;
const state = pane.terminal orelse return false;
- return state.vt.screens.active_key != .alternate and
- state.vt.screens.active.cursor.semantic_content == .input;
+ return state.vt.screens.active.cursor.semantic_content == .input;
}
pub const CommandOutput = struct {