fix: make regular URLs work with either ctrl or super modifiers

pull/7551/head
Alex Straight 2025-06-08 23:08:11 -07:00 committed by Mitchell Hashimoto
parent 5836dc4ce6
commit fc1307e939
1 changed files with 11 additions and 1 deletions

View File

@ -3712,7 +3712,17 @@ fn linkAtPos(
for (self.config.links) |link| {
switch (link.highlight) {
.always, .hover => {},
.always_mods, .hover_mods => |v| if (!v.equal(mouse_mods)) continue,
.always_mods, .hover_mods => |v| {
// Special case: if the expected mods are "ctrl or super" (like the default URL config),
// then we should match if the user pressed either ctrl or super, just like OSC8 links.
const is_ctrl_or_super_expected = (v.ctrl and !v.super and !v.shift and !v.alt) or
(v.super and !v.ctrl and !v.shift and !v.alt);
if (is_ctrl_or_super_expected) {
if (!(mouse_mods.ctrl or mouse_mods.super)) continue;
} else {
if (!v.equal(mouse_mods)) continue;
}
},
}
var it = strmap.searchIterator(link.regex);