diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 14:43:17 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | ada81f05127506dec0dbb7af390cb43fd0da9d40 (patch) | |
| tree | 6559fe9446530528dbd62b37a4dbf9d70c331736 /src/exec.zig | |
| parent | def16a1bc1c71d2fdcc7954e2ddec1384c2f05f7 (diff) | |
| download | pardes-ada81f05127506dec0dbb7af390cb43fd0da9d40.tar.gz pardes-ada81f05127506dec0dbb7af390cb43fd0da9d40.zip | |
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 <[email protected]>
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/exec.zig b/src/exec.zig index 86dba32a..8b058a12 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -427,6 +427,12 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize { pane.command_done = false; pane.command_status = null; pane.body.mode = .tty; + // What the last program left the emulator in goes first: the + // alternate screen left (only if it is there: leaving restores a + // saved cursor), mouse reports and bracketed paste off, the cursor + // shown, then a soft reset (DECSTR) for the rest. + if (panes.Terminal.onAlternateScreen(pane)) panes.Terminal.feedOutput(p, pane, "\x1b[?1049l"); + panes.Terminal.feedOutput(p, pane, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[!p"); var buf: [command_max + 8]u8 = undefined; const lead = if (panes.Terminal.gridCursor(pane).x != 0) "\r\n" else ""; panes.Terminal.feedOutput(p, pane, std.fmt.bufPrint(&buf, "{s}% {s}\r\n", .{ lead, line }) catch "%\r\n"); |
