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.

editor: Fix `select_larget_syntax_node` overflowing in multibuffers (#38308)

Lukas Wirthc5ac1e6218d7
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 8f69efe30ef..49a09385d52 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -14988,15 +14988,13 @@ impl Editor {
let mut new_range = old_range.clone();
while let Some((node, containing_range)) = buffer.syntax_ancestor(new_range.clone())
{
- if !node.is_named() {
- new_range = node.start_byte()..node.end_byte();
- continue;
- }
-
new_range = match containing_range {
MultiOrSingleBufferOffsetRange::Single(_) => break,
MultiOrSingleBufferOffsetRange::Multi(range) => range,
};
+ if !node.is_named() {
+ continue;
+ }
if !display_map.intersects_fold(new_range.start)
&& !display_map.intersects_fold(new_range.end)
{