G1: restore Alt-drag copy for existing ruler guides (#2997).

Drop the undocumented orientation-swap on moved guides; Alt again previews guide.move with copy, matching new-guide Alt orientation only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
nrq6993-a11y
2026-10-19 23:17:28 +03:00
co-authored by Cursor
parent 32a322531a
commit 2ceb183bfe
4 changed files with 39 additions and 78 deletions
+1 -4
View File
@@ -207,7 +207,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Guide",
[],
None,
"{index, pos: pt, vertical?: bool} | {dx?, dy?: pt, copy?: bool} put ruler guide `index` at `pos` (and swap its orientation when `vertical` is given), or move the selected guides (vertical ones by dx, horizontal ones by dy); copy leaves them and selects the moved copies",
"{index, pos: pt} | {dx?, dy?: pt, copy?: bool} put ruler guide `index` at `pos`, or move the selected guides (vertical ones by dx, horizontal ones by dy); copy leaves them and selects the moved copies",
guides_unlocked,
guide_move
),
@@ -769,9 +769,6 @@ pub(crate) fn guide_move(s: &mut Session, p: &Value) -> Result<Value> {
s.edit("Move Guide", |d, _| {
if let Some(g) = d.guides.get_mut(i) {
g.pos = pos;
if p.get("vertical").is_some() {
g.vertical = bool_or(p, "vertical", false);
}
}
Ok(())
})?;
-8
View File
@@ -2011,14 +2011,6 @@ fn ruler_guides_and_lock() {
assert!(s.execute("guide.remove", &json!({"index": 0})).is_err());
}
#[test]
fn guide_move_can_swap_orientation() {
let mut s = session();
s.execute("guide.add", &json!({"vertical": false, "pos": 50})).unwrap();
s.execute("guide.move", &json!({"index": 0, "pos": 120, "vertical": true})).unwrap();
assert_eq!((s.doc().unwrap().doc.guides[0].vertical, s.doc().unwrap().doc.guides[0].pos), (true, 120.0));
}
/// #1534: Lock Guides locks the paths made into guides too: they can't be selected (so neither
/// moved, reshaped nor deleted), by a click, a marquee or Select All, and locking lets them go.
#[test]