From f975861891ae9cf6d6d4a21a4e52ed9f09fa15e0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 7 May 2024 10:36:54 -0700 Subject: [PATCH] terminal: maintain dirty bits when rotating rows on clone --- src/terminal/PageList.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index 158717359..d505465cf 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -473,6 +473,11 @@ pub fn clone( continue; } + // We want to maintain the dirty bits from the original page so + // instead of setting a range we grab the dirty bit and then + // set it on the new page in the new location. + var dirty = page.data.dirtyBitSet(); + // Kind of slow, we want to shift the rows up in the page up to // end and then resize down. const rows = page.data.rows.ptr(page.data.memory); @@ -483,6 +488,7 @@ pub fn clone( const old_dst = dst.*; dst.* = src.*; src.* = old_dst; + dirty.setValue(i, dirty.isSet(i + chunk.start)); } page.data.size.rows = @intCast(len); total_rows += len;