From a1372a0efde15ac8f1f323d06c84da90f9cd39d3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 7 May 2024 09:55:32 -0700 Subject: [PATCH] terminal: more dirty tracking --- src/terminal/Screen.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 45d5db71b..6490376b4 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -633,6 +633,9 @@ pub fn cursorDownScroll(self: *Screen) !void { self.cursor.page_row = page_rac.row; self.cursor.page_cell = page_rac.cell; + // Our new row is always dirty + self.cursorMarkDirty(); + // Clear the new row so it gets our bg color. We only do this // if we have a bg color at all. if (self.cursor.style.bg_color != .none) { @@ -2889,6 +2892,7 @@ test "Screen: cursorAbsolute across pages preserves style" { try testing.expect(styleval.flags.bold); } } + test "Screen: scrolling" { const testing = std.testing; const alloc = testing.allocator; @@ -2967,6 +2971,12 @@ test "Screen: scrolling with a single-row screen with scrollback" { try testing.expectEqualStrings("", contents); } + // Active should be dirty + try testing.expect(s.pages.isDirty(.{ .active = .{ .x = 0, .y = 0 } })); + + // Our scrollback should not be dirty + try testing.expect(!s.pages.isDirty(.{ .screen = .{ .x = 0, .y = 0 } })); + s.scroll(.{ .delta_row = -1 }); { const contents = try s.dumpStringAlloc(alloc, .{ .viewport = .{} });