From 3d0147aafc2ccdc72e4c8fc269b01269c5546cc4 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Sun, 25 May 2025 18:52:40 -0400 Subject: [PATCH] Preserve selection direction when running an `editor: open selections in multibuffer` (#31399) Release Notes: - Preserve selection direction when running an `editor: open selections in multibuffer` --- crates/editor/src/editor.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 017ebbcfb4..df79e5eec3 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -17509,9 +17509,16 @@ impl Editor { .selections .disjoint_anchors() .iter() - .map(|range| Location { - buffer: buffer.clone(), - range: range.start.text_anchor..range.end.text_anchor, + .map(|selection| { + let range = if selection.reversed { + selection.end.text_anchor..selection.start.text_anchor + } else { + selection.start.text_anchor..selection.end.text_anchor + }; + Location { + buffer: buffer.clone(), + range, + } }) .collect::>();