Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Don't push to selection history if selections are empty (#32433)

Michael Sloan08210b512ddc
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 54176e137cb..000854bbdf4 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -1244,6 +1244,13 @@ impl SelectionHistory {
transaction_id: TransactionId,
selections: Arc<[Selection<Anchor>]>,
) {
+ if selections.is_empty() {
+ log::error!(
+ "SelectionHistory::insert_transaction called with empty selections. Caller: {}",
+ std::panic::Location::caller()
+ );
+ return;
+ }
self.selections_by_transaction
.insert(transaction_id, (selections, None));
}