set proper dirty state to redo viewport search

pull/9687/head
Mitchell Hashimoto 2025-11-24 13:59:50 -08:00
parent 06981175af
commit a4e40c7567
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 20 additions and 1 deletions

View File

@ -1126,6 +1126,12 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
// Update our terminal state
try self.terminal_state.update(self.alloc, state.terminal);
// If our terminal state is dirty at all we need to redo
// the viewport search.
if (self.terminal_state.dirty != .false) {
state.terminal.flags.search_viewport_dirty = true;
}
// Get our scrollbar out of the terminal. We synchronize
// the scrollbar read with frame data updates because this
// naturally limits the number of calls to this method (it

View File

@ -656,15 +656,22 @@ pub const RenderState = struct {
// of highlights is usually small, and this only happens on the
// viewport outside of a locked area. Still, I'd love to see this
// improved someday.
// We need to track whether any row had a match so we can mark
// the dirty state.
var any_dirty: bool = false;
const row_data = self.row_data.slice();
const row_arenas = row_data.items(.arena);
const row_dirties = row_data.items(.dirty);
const row_pins = row_data.items(.pin);
const row_highlights_slice = row_data.items(.highlights);
for (
row_arenas,
row_pins,
row_highlights_slice,
) |*row_arena, row_pin, *row_highlights| {
row_dirties,
) |*row_arena, row_pin, *row_highlights, *dirty| {
for (hls) |hl| {
const chunks_slice = hl.chunks.slice();
const nodes = chunks_slice.items(.node);
@ -688,9 +695,15 @@ pub const RenderState = struct {
if (i == nodes.len - 1) hl.bot_x else self.cols - 1,
},
);
dirty.* = true;
any_dirty = true;
}
}
}
// Mark our dirty state.
if (any_dirty and self.dirty == .false) self.dirty = .partial;
}
pub const StringMap = std.ArrayListUnmanaged(point.Coordinate);