terminal: maintain dirty bits when rotating rows on clone

This commit is contained in:
Mitchell Hashimoto
2024-05-07 10:36:54 -07:00
parent 165c2d9056
commit f975861891

View File

@ -473,6 +473,11 @@ pub fn clone(
continue; 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 // Kind of slow, we want to shift the rows up in the page up to
// end and then resize down. // end and then resize down.
const rows = page.data.rows.ptr(page.data.memory); const rows = page.data.rows.ptr(page.data.memory);
@ -483,6 +488,7 @@ pub fn clone(
const old_dst = dst.*; const old_dst = dst.*;
dst.* = src.*; dst.* = src.*;
src.* = old_dst; src.* = old_dst;
dirty.setValue(i, dirty.isSet(i + chunk.start));
} }
page.data.size.rows = @intCast(len); page.data.size.rows = @intCast(len);
total_rows += len; total_rows += len;