mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-19 00:01:58 +00:00
termio: unconditionally show "process exited" message
We previously only showed this message if the user had `wait-after-command` set to true, since if its false the surface would close anyways. With the latest undo feature on macOS, this is no longer the case; a exited process can be undone and reopened. I considered disallowing undoing an exited surface, but I think there is value in being able to go back and recapture output in scrollback if you wanted to.
This commit is contained in:
@@ -418,25 +418,27 @@ fn processExitCommon(td: *termio.Termio.ThreadData, exit_code: u32) void {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We output a message so that the user knows whats going on and
|
||||||
|
// doesn't think their terminal just froze. We show this unconditionally
|
||||||
|
// on close even if `wait_after_command` is false and the surface closes
|
||||||
|
// immediately because if a user does an `undo` to restore a closed
|
||||||
|
// surface then they will see this message and know the process has
|
||||||
|
// completed.
|
||||||
|
terminal: {
|
||||||
|
td.renderer_state.mutex.lock();
|
||||||
|
defer td.renderer_state.mutex.unlock();
|
||||||
|
const t = td.renderer_state.terminal;
|
||||||
|
t.carriageReturn();
|
||||||
|
t.linefeed() catch break :terminal;
|
||||||
|
t.printString("Process exited. Press any key to close the terminal.") catch
|
||||||
|
break :terminal;
|
||||||
|
t.modes.set(.cursor_visible, false);
|
||||||
|
}
|
||||||
|
|
||||||
// If we're purposely waiting then we just return since the process
|
// If we're purposely waiting then we just return since the process
|
||||||
// exited flag is set to true. This allows the terminal window to remain
|
// exited flag is set to true. This allows the terminal window to remain
|
||||||
// open.
|
// open.
|
||||||
if (execdata.wait_after_command) {
|
if (execdata.wait_after_command) return;
|
||||||
// We output a message so that the user knows whats going on and
|
|
||||||
// doesn't think their terminal just froze.
|
|
||||||
terminal: {
|
|
||||||
td.renderer_state.mutex.lock();
|
|
||||||
defer td.renderer_state.mutex.unlock();
|
|
||||||
const t = td.renderer_state.terminal;
|
|
||||||
t.carriageReturn();
|
|
||||||
t.linefeed() catch break :terminal;
|
|
||||||
t.printString("Process exited. Press any key to close the terminal.") catch
|
|
||||||
break :terminal;
|
|
||||||
t.modes.set(.cursor_visible, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify our surface we want to close
|
// Notify our surface we want to close
|
||||||
_ = td.surface_mailbox.push(.{
|
_ = td.surface_mailbox.push(.{
|
||||||
|
Reference in New Issue
Block a user