core: only dump scrollback contents if there is scrollback

Fixes #1353
This commit is contained in:
Mitchell Hashimoto
2024-01-21 20:55:41 -08:00
parent 23cd77884d
commit 2c924be9b1

View File

@ -2933,12 +2933,17 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
&self.io.terminal.screen,
);
// We only dump history if we have history. We still keep
// the file and write the empty file to the pty so that this
// command always works on the primary screen.
if (history_max > 0) {
try self.io.terminal.screen.dumpString(file.writer(), .{
.start = .{ .history = 0 },
.end = .{ .history = history_max -| 1 },
.unwrap = true,
});
}
}
// Get the final path
var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;