From 037f8d3a5e6eb5c2ed698a9eee79e86a8f69b301 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 28 Apr 2024 14:48:29 -0700 Subject: [PATCH] terminal: set dirty bit for screen swap --- src/terminal/Terminal.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 031a399fa..176ccc0fa 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -131,6 +131,10 @@ pub const Dirty = packed struct { /// Set when the reverse colors mode is modified. reverse_colors: bool = false, + + /// Screen clear of some kind. This can be due to a screen change, + /// erase display, etc. + clear: bool = false, }; /// The event types that can be reported for mouse-related activities. @@ -2095,6 +2099,9 @@ pub fn eraseDisplay( self, .{ .all = true }, ); + + // Cleared screen dirty bit + self.flags.dirty.clear = true; }, .below => { @@ -2453,6 +2460,9 @@ pub fn alternateScreen( // Mark kitty images as dirty so they redraw self.screen.kitty_images.dirty = true; + // Mark our terminal as dirty + self.flags.dirty.clear = true; + // Bring our pen with us self.screen.cursorCopy(old.cursor) catch |err| { log.warn("cursor copy failed entering alt screen err={}", .{err}); @@ -2488,6 +2498,9 @@ pub fn primaryScreen( // Mark kitty images as dirty so they redraw self.screen.kitty_images.dirty = true; + // Mark our terminal as dirty + self.flags.dirty.clear = true; + // Restore the cursor from the primary screen. This should not // fail because we should not have to allocate memory since swapping // screens does not create new cursors.