renderer: match multiple lines for osc8

This commit is contained in:
Mitchell Hashimoto
2024-07-04 19:55:29 -07:00
parent 041c779512
commit 925ad5b45c
4 changed files with 21 additions and 5 deletions

View File

@ -2825,10 +2825,7 @@ pub fn cursorPosCallback(
if (try self.linkAtPos(pos)) |_| {
self.renderer_state.mouse.point = pos_vp;
self.mouse.over_link = true;
// Mark the new link's row as dirty.
if (self.renderer_state.terminal.screen.pages.pin(.{ .viewport = pos_vp })) |pin| {
pin.markDirty();
}
self.renderer_state.terminal.screen.dirty.hyperlink_hover = true;
try self.rt_surface.setMouseShape(.pointer);
try self.queueRender();
} else if (over_link) {

View File

@ -2005,7 +2005,7 @@ fn rebuildCells(
if (self.updateCell(
screen,
cell,
if (link_match_set.orderedContains(screen, cell))
if (link_match_set.contains(screen, cell))
.single
else
null,

View File

@ -274,6 +274,21 @@ pub const MatchSet = struct {
alloc.free(self.matches);
}
/// Checks if the matchset contains the given pin. This is slower than
/// orderedContains but is stateless and more flexible since it doesn't
/// require the points to be in order.
pub fn contains(
self: *MatchSet,
screen: *const Screen,
pin: terminal.Pin,
) bool {
for (self.matches) |sel| {
if (sel.contains(screen, pin)) return true;
}
return false;
}
/// Checks if the matchset contains the given pt. The points must be
/// given in left-to-right top-to-bottom order. This is a stateful
/// operation and giving a point out of order can cause invalid

View File

@ -72,6 +72,10 @@ pub const Dirty = packed struct {
/// Set when the selection is set or unset, regardless of if the
/// selection is changed or not.
selection: bool = false,
/// When an OSC8 hyperlink is hovered, we set the full screen as dirty
/// because links can span multiple lines.
hyperlink_hover: bool = false,
};
/// The cursor position.