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.

Fix panic on select all when query is empty

Mikaylafe1087528544
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 29782eb1f35..0827e132640 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -6048,10 +6048,12 @@ impl Editor {
let query = buffer
.text_for_range(selection.start..selection.end)
.collect::<String>();
+
+ let is_empty = query.is_empty();
let select_state = SelectNextState {
query: AhoCorasick::new(&[query])?,
wordwise: true,
- done: false,
+ done: is_empty,
};
select_next_match_ranges(
self,