termio/exec: only clear above cursor if cursor is not on y=0

This commit is contained in:
Mitchell Hashimoto
2024-03-19 08:24:04 -07:00
parent 06d944c292
commit 26321dc1c9

View File

@ -478,11 +478,14 @@ pub fn clearScreen(self: *Exec, history: bool) !void {
// If we're not at a prompt, we just delete above the cursor.
if (!self.terminal.cursorIsAtPrompt()) {
self.terminal.screen.clearRows(
.{ .active = .{ .y = 0 } },
.{ .active = .{ .y = self.terminal.screen.cursor.y - 1 } },
false,
);
if (self.terminal.screen.cursor.y > 0) {
self.terminal.screen.clearRows(
.{ .active = .{ .y = 0 } },
.{ .active = .{ .y = self.terminal.screen.cursor.y - 1 } },
false,
);
}
return;
}