From 5270844b427fee21ef6d2237dea2f40aadb61412 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Tue, 10 Jun 2025 15:31:38 -0400 Subject: [PATCH] Revert "Preserve selection direction when running `editor: open selections in multibuffer`" (#32483) Reverts zed-industries/zed#31399 I found that in some cases, Zed will panic when using `editor: open selections in multibuffer` if the selection is reversed. It doesn't happen in most cases that I've tested, but in some strange edge cases (that I dont fully understand ATM), it does. I'm reverting for now, as the previous behavior is better than a panic, but will re-implement this fix to preserving selection directions in a new PR with comprehensive testing Release Notes: - N/A --- crates/editor/src/editor.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0dd894beed..2da1d34161 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -18137,16 +18137,9 @@ impl Editor { .selections .disjoint_anchors() .iter() - .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, - } + .map(|range| Location { + buffer: buffer.clone(), + range: range.start.text_anchor..range.end.text_anchor, }) .collect::>();