renderer: receive message with viewport match selections

Doesn't draw yet
This commit is contained in:
Mitchell Hashimoto
2025-11-16 07:05:32 -08:00
parent 061d157b50
commit 6c8ffb5fc1
4 changed files with 71 additions and 5 deletions

View File

@@ -122,6 +122,16 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
scrollbar: terminal.Scrollbar,
scrollbar_dirty: bool,
/// The most recent viewport matches so that we can render search
/// matches in the visible frame. This is provided asynchronously
/// from the search thread so we have the dirty flag to also note
/// if we need to rebuild our cells to include search highlights.
///
/// Note that the selections MAY BE INVALID (point to PageList nodes
/// that do not exist anymore). These must be validated prior to use.
search_matches: ?renderer.Message.SearchMatches,
search_matches_dirty: bool,
/// The current set of cells to render. This is rebuilt on every frame
/// but we keep this around so that we don't reallocate. Each set of
/// cells goes into a separate shader.
@@ -672,6 +682,8 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
.focused = true,
.scrollbar = .zero,
.scrollbar_dirty = false,
.search_matches = null,
.search_matches_dirty = false,
// Render state
.cells = .{},
@@ -744,7 +756,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
pub fn deinit(self: *Self) void {
self.terminal_state.deinit(self.alloc);
if (self.search_matches) |*m| m.arena.deinit();
self.swap_chain.deinit();
if (DisplayLink != void) {