terminal: set dirty bit for screen swap

This commit is contained in:
Mitchell Hashimoto
2024-04-28 14:48:29 -07:00
parent b166ca7e30
commit 037f8d3a5e

View File

@ -131,6 +131,10 @@ pub const Dirty = packed struct {
/// Set when the reverse colors mode is modified. /// Set when the reverse colors mode is modified.
reverse_colors: bool = false, 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. /// The event types that can be reported for mouse-related activities.
@ -2095,6 +2099,9 @@ pub fn eraseDisplay(
self, self,
.{ .all = true }, .{ .all = true },
); );
// Cleared screen dirty bit
self.flags.dirty.clear = true;
}, },
.below => { .below => {
@ -2453,6 +2460,9 @@ pub fn alternateScreen(
// Mark kitty images as dirty so they redraw // Mark kitty images as dirty so they redraw
self.screen.kitty_images.dirty = true; self.screen.kitty_images.dirty = true;
// Mark our terminal as dirty
self.flags.dirty.clear = true;
// Bring our pen with us // Bring our pen with us
self.screen.cursorCopy(old.cursor) catch |err| { self.screen.cursorCopy(old.cursor) catch |err| {
log.warn("cursor copy failed entering alt screen err={}", .{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 // Mark kitty images as dirty so they redraw
self.screen.kitty_images.dirty = true; 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 // Restore the cursor from the primary screen. This should not
// fail because we should not have to allocate memory since swapping // fail because we should not have to allocate memory since swapping
// screens does not create new cursors. // screens does not create new cursors.