From ada81f05127506dec0dbb7af390cb43fd0da9d40 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 14:43:17 -0300 Subject: A reused command pane leaves the last program's screen modes before the next command A program that crashed out of a full screen left the command pane's emulator in the alternate screen with mouse reports, bracketed paste or a hidden cursor on, and the next command ran in that. Before the '% line' separator the pane now leaves the alternate screen, turns those modes off and soft-resets (DECSTR). The docs add that a command which clears the screen and its scrollback erases the pane's history above it. Co-Authored-By: Claude Opus 5.5 --- src/Terminal.zig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Terminal.zig') diff --git a/src/Terminal.zig b/src/Terminal.zig index cd292e5f..e204b44c 100644 --- a/src/Terminal.zig +++ b/src/Terminal.zig @@ -932,6 +932,13 @@ test "raw terminal output needs no position tracking allocations" { try std.testing.expectEqual(pins, pane.terminal.?.vt.screens.active.pages.countTrackedPins()); } +/// A full-screen program has the emulator on its alternate screen. +pub fn onAlternateScreen(pane: *const Pane) bool { + if (comptime !enabled) return false; + const state = pane.terminal orelse return false; + return state.vt.screens.active_key == .alternate; +} + pub fn promptInputReady(pane: *const Pane) bool { if (comptime !enabled) return false; const state = pane.terminal orelse return false; -- cgit v1.3