From 0cee115ba3f8aade9f02062abcca2a4fd1b3ad8d Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Mon, 8 Jul 2024 22:22:18 -0400 Subject: [PATCH] terminal/page: use addWithIdContext when cloning hyperlink data --- src/terminal/page.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/terminal/page.zig b/src/terminal/page.zig index dee90a785..49e1de475 100644 --- a/src/terminal/page.zig +++ b/src/terminal/page.zig @@ -684,11 +684,12 @@ pub const Page = struct { // add it, and migrate. const id = other.lookupHyperlink(src_cell).?; const other_link = other.hyperlink_set.get(other.memory, id); - const dst_id = try self.hyperlink_set.addContext( + const dst_id = try self.hyperlink_set.addWithIdContext( self.memory, try other_link.dupe(other, self), + id, .{ .page = self }, - ); + ) orelse id; try self.setHyperlink(dst_row, dst_cell, dst_id); } if (src_cell.style_id != style.default_id) { @@ -705,13 +706,11 @@ pub const Page = struct { // Slow path: Get the style from the other // page and add it to this page's style set. const other_style = other.styles.get(other.memory, src_cell.style_id); - if (try self.styles.addWithId( + dst_cell.style_id = try self.styles.addWithId( self.memory, other_style.*, src_cell.style_id, - )) |id| { - dst_cell.style_id = id; - } + ) orelse src_cell.style_id; } } }