From 39450b80d1eebfd78b4a0729fb4d57c2b1da832f Mon Sep 17 00:00:00 2001 From: xc4pr <88853037+xc4pr@users.noreply.github.com> Date: Fri, 23 Oct 2026 17:48:45 +0200 Subject: [PATCH] Hyperlinks: Ctrl+Alt+click on a link extends the selection again (#2368) --- crates/ui-egui/src/grid.rs | 3 ++- crates/ui-egui/tests/it/hyperlink_ctrl_click.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index 40ef2c8e9..75858ad4e 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -2397,9 +2397,10 @@ fn interact(app: &mut SheetApp, ui: &mut egui::Ui, resp: &egui::Response, geo: & d.selection.anchor = sel.anchor; } } else if mods.command { - // Ctrl+click on a hyperlink's text follows it instead of adding the cell to the selection. + // Ctrl+click (without Alt) on a hyperlink's text follows it instead of adding the cell to the selection. if let Some(h) = sh.hyperlinks.get(&c).cloned() && primary_clicked + && !mods.alt && p.x < geo.cell_rect(sh, c).left() + geo.cell_rect(sh, c).width() * 0.8 { follow_link(app, &h.target); diff --git a/crates/ui-egui/tests/it/hyperlink_ctrl_click.rs b/crates/ui-egui/tests/it/hyperlink_ctrl_click.rs index 2e557e12e..a61350d3d 100644 --- a/crates/ui-egui/tests/it/hyperlink_ctrl_click.rs +++ b/crates/ui-egui/tests/it/hyperlink_ctrl_click.rs @@ -83,3 +83,15 @@ fn ctrl_click_beside_the_link_text_still_extends_the_selection() { assert_eq!(ranges, ["B2", "B4"], "the hyperlink cell joins the selection"); assert!(h.state().dialog.is_none(), "no link was followed"); } + +#[test] +fn ctrl_alt_click_on_the_link_text_still_extends_the_selection() { + let mut h = harness(); + click_at(&mut h, "B2", 0.9, Modifiers::NONE); + click_at(&mut h, "B4", 0.3, Modifiers { alt: true, ..Modifiers::COMMAND }); + let d = h.state().session.active().unwrap(); + let ranges: Vec = d.selection.ranges.iter().map(|r| r.a1()).collect(); + assert_eq!(ranges, ["B2", "B4"], "Ctrl+Alt+click adds the hyperlink cell to the selection"); + assert_eq!(d.selection.active.a1(), "B4", "the link was not followed"); + assert!(h.state().dialog.is_none(), "no link dialog"); +}