From 26321dc1c9556a40e1b51ec0a3820baee539ed3c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 19 Mar 2024 08:24:04 -0700 Subject: [PATCH] termio/exec: only clear above cursor if cursor is not on y=0 --- src/termio/Exec.zig | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 1dab11741..e3d08f2b3 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -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; }