diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 0d546b7a7..e89454f9d 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1553,17 +1553,14 @@ fn rebuildCells( var arena = ArenaAllocator.init(self.alloc); defer arena.deinit(); const arena_alloc = arena.allocator(); - _ = arena_alloc; - _ = mouse; // Create our match set for the links. - // TODO(paged-terminal) - // var link_match_set: link.MatchSet = if (mouse.point) |mouse_pt| try self.config.links.matchSet( - // arena_alloc, - // screen, - // mouse_pt, - // mouse.mods, - // ) else .{}; + var link_match_set: link.MatchSet = if (mouse.point) |mouse_pt| try self.config.links.matchSet( + arena_alloc, + screen, + mouse_pt, + mouse.mods, + ) else .{}; // Determine our x/y range for preedit. We don't want to render anything // here because we will render the preedit separately. @@ -1672,21 +1669,15 @@ fn rebuildCells( var copy = row; copy.x = shaper_cell.x; break :cell copy; - - // TODO(paged-terminal) - // // If our links contain this cell then we want to - // // underline it. - // if (link_match_set.orderedContains(.{ - // .x = shaper_cell.x, - // .y = y, - // })) { - // cell.attrs.underline = .single; - // } }; if (self.updateCell( screen, cell, + if (link_match_set.orderedContains(screen, cell)) + .single + else + null, color_palette, shaper_cell, run, @@ -1754,6 +1745,7 @@ fn updateCell( self: *Metal, screen: *const terminal.Screen, cell_pin: terminal.Pin, + cell_underline: ?terminal.Attribute.Underline, palette: *const terminal.color.Palette, shaper_cell: font.shape.Cell, shaper_run: font.shape.TextRun, @@ -1781,6 +1773,7 @@ fn updateCell( const rac = cell_pin.rowAndCell(); const cell = rac.cell; const style = cell_pin.style(cell); + const underline = cell_underline orelse style.flags.underline; // The colors for the cell. const colors: BgFg = colors: { @@ -1910,8 +1903,8 @@ fn updateCell( }); } - if (style.flags.underline != .none) { - const sprite: font.Sprite = switch (style.flags.underline) { + if (underline != .none) { + const sprite: font.Sprite = switch (underline) { .none => unreachable, .single => .underline, .double => .underline_double, diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index fab2ae37e..47d660b34 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -974,20 +974,17 @@ pub fn rebuildCells( var arena = ArenaAllocator.init(self.alloc); defer arena.deinit(); const arena_alloc = arena.allocator(); - _ = arena_alloc; - _ = mouse; // We've written no data to the GPU, refresh it all self.gl_cells_written = 0; // Create our match set for the links. - // TODO(paged-terminal) - // var link_match_set: link.MatchSet = if (mouse.point) |mouse_pt| try self.config.links.matchSet( - // arena_alloc, - // screen, - // mouse_pt, - // mouse.mods, - // ) else .{}; + var link_match_set: link.MatchSet = if (mouse.point) |mouse_pt| try self.config.links.matchSet( + arena_alloc, + screen, + mouse_pt, + mouse.mods, + ) else .{}; // Determine our x/y range for preedit. We don't want to render anything // here because we will render the preedit separately. @@ -1085,23 +1082,15 @@ pub fn rebuildCells( var copy = row; copy.x = shaper_cell.x; break :cell copy; - - // TODO(paged-terminal) - // // If our links contain this cell then we want to - // // underline it. - // if (link_match_set.orderedContains(.{ - // .x = shaper_cell.x, - // .y = y, - // })) { - // cell.attrs.underline = .single; - // } - // - // break :cell cell; }; if (self.updateCell( screen, cell, + if (link_match_set.orderedContains(screen, cell)) + .single + else + null, color_palette, shaper_cell, run, @@ -1330,6 +1319,7 @@ fn updateCell( self: *OpenGL, screen: *terminal.Screen, cell_pin: terminal.Pin, + cell_underline: ?terminal.Attribute.Underline, palette: *const terminal.color.Palette, shaper_cell: font.shape.Cell, shaper_run: font.shape.TextRun, @@ -1357,6 +1347,7 @@ fn updateCell( const rac = cell_pin.rowAndCell(); const cell = rac.cell; const style = cell_pin.style(cell); + const underline = cell_underline orelse style.flags.underline; // The colors for the cell. const colors: BgFg = colors: { @@ -1507,8 +1498,8 @@ fn updateCell( }); } - if (style.flags.underline != .none) { - const sprite: font.Sprite = switch (style.flags.underline) { + if (underline != .none) { + const sprite: font.Sprite = switch (underline) { .none => unreachable, .single => .underline, .double => .underline_double,