Update keymap context binding behavior of > and ! (#34664)
Now ! means "no ancestors matches this", and > means "any descendent" not "any child". Updates #34570 Co-authored-by: Ben Kunkle <ben@zed.dev> Release Notes: - *Breaking change*. The context predicates in the keymap file now handle ! and > differently. Before this change ! meant "this node does not match", now it means "none of these nodes match". Before this change > meant "child of", now it means "descendent of". We do not expect these changes to break many keymaps, but they may cause subtle changes for complex context queries. --------- Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
parent
f461290ac3
commit
e421fc7a2d
6 changed files with 261 additions and 90 deletions
|
@ -132,14 +132,7 @@ impl KeyContextView {
|
|||
}
|
||||
|
||||
fn matches(&self, predicate: &KeyBindingContextPredicate) -> bool {
|
||||
let mut stack = self.context_stack.clone();
|
||||
while !stack.is_empty() {
|
||||
if predicate.eval(&stack) {
|
||||
return true;
|
||||
}
|
||||
stack.pop();
|
||||
}
|
||||
false
|
||||
predicate.depth_of(&self.context_stack).is_some()
|
||||
}
|
||||
|
||||
fn action_matches(&self, a: &Option<Box<dyn Action>>, b: &dyn Action) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue