From 0c3cf0628adf9e22270b09d9c451b08ac07f558a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 04:57:43 -0300 Subject: 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 --- src/terminal.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/terminal.zig') 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 { -- cgit v1.3