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: Add "selection" key context (#21927)

Ozan72d8f2e595fa
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 6dcd2c17a82..f86acc72b7f 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -1402,6 +1402,15 @@ impl Editor {
key_context.add("inline_completion");
}
+ if !self
+ .selections
+ .disjoint
+ .iter()
+ .all(|selection| selection.start == selection.end)
+ {
+ key_context.add("selection");
+ }
+
key_context
}