From 8b02d3430cea0a1fbdd906cb5dc0f6304dc62ce6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 4 Jul 2024 20:00:30 -0700 Subject: [PATCH] terminal: copy hyperlinks on reflow --- src/terminal/PageList.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index e339f66ba..79551b178 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -1162,6 +1162,24 @@ fn reflowPage( }, } + // If the source cell has a hyperlink we need to copy it + if (src_cursor.page_cell.hyperlink) { + const src_page = src_cursor.page; + const dst_page = dst_cursor.page; + const id = src_page.lookupHyperlink(src_cursor.page_cell).?; + const src_link = src_page.hyperlink_set.get(src_page.memory, id); + const dst_id = try dst_page.hyperlink_set.addContext( + dst_page.memory, + try src_link.dupe(src_page, dst_page), + .{ .page = dst_page }, + ); + try dst_page.setHyperlink( + dst_cursor.page_row, + dst_cursor.page_cell, + dst_id, + ); + } + // If the source cell has a style, we need to copy it. if (src_cursor.page_cell.style_id != stylepkg.default_id) { const src_style = src_cursor.page.styles.get(