From cd305348080ce5465b69f93a8c3f256cf3069d86 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 22 Mar 2024 11:55:55 -0700 Subject: [PATCH] terminal: no scrollback eraseRows needs to fix style --- src/terminal/Screen.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index bf16e25c8..e31b28683 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -539,6 +539,20 @@ pub fn cursorDownScroll(self: *Screen) !void { // Erase rows will shift our rows up self.pages.eraseRows(.{ .active = .{} }, .{ .active = .{} }); + // The above may clear our cursor so we need to update that + // again. If this fails (highly unlikely) we just reset + // the cursor. + self.manualStyleUpdate() catch |err| { + // This failure should not happen because manualStyleUpdate + // handles page splitting, overflow, and more. This should only + // happen if we're out of RAM. In this case, we'll just degrade + // gracefully back to the default style. + log.err("failed to update style on cursor scroll err={}", .{err}); + self.cursor.style = .{}; + self.cursor.style_id = 0; + self.cursor.style_ref = null; + }; + // We need to move our cursor down one because eraseRows will // preserve our pin directly and we're erasing one row. const page_pin = self.cursor.page_pin.down(1).?;