mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-26 03:36:54 -06:00
Hyperlinks: Ctrl+Alt+click on a link extends the selection again (#2368)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<String> = 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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user