From 8e6e62a2382877d8911446d35243a8650df85644 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 09:42:46 +0000 Subject: [PATCH] fix: use ordered $from/$to for multi-cursor SelectionRange on Alt+click Backward selections (right-to-left) produced inverted ranges because SelectionRange($anchor, $head) does not reorder its arguments. Switch to $from/$to which are always ordered. Closes #511 Co-Authored-By: Claude Opus 4.6 --- src/plugins/multiCursor/altClick.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/multiCursor/altClick.ts b/src/plugins/multiCursor/altClick.ts index 6714ae4b2..9d828731a 100644 --- a/src/plugins/multiCursor/altClick.ts +++ b/src/plugins/multiCursor/altClick.ts @@ -121,7 +121,7 @@ export function addCursorAtPosition( } // Convert single selection to MultiSelection - const existingRange = new SelectionRange(selection.$anchor, selection.$head); + const existingRange = new SelectionRange(selection.$from, selection.$to); // Check if clicking on same position if (selection.from === snappedPos && selection.to === snappedPos) {