Avoid re-allocating KeymapContext after every view notification

This commit is contained in:
Antonio Scandurra 2023-05-04 12:04:30 +02:00
parent 18e39ef2fa
commit 3d679ddb26
12 changed files with 74 additions and 75 deletions

View file

@ -1831,12 +1831,11 @@ impl View for Pane {
});
}
fn keymap_context(&self, _: &AppContext) -> KeymapContext {
let mut keymap = Self::default_keymap_context();
fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) {
Self::reset_to_default_keymap_context(keymap);
if self.docked.is_some() {
keymap.add_identifier("docked");
}
keymap
}
}

View file

@ -37,7 +37,6 @@ use gpui::{
vector::{vec2f, Vector2F},
},
impl_actions,
keymap_matcher::KeymapContext,
platform::{
CursorStyle, MouseButton, PathPromptOptions, Platform, PromptLevel, WindowBounds,
WindowOptions,
@ -2809,10 +2808,6 @@ impl View for Workspace {
}
}
}
fn keymap_context(&self, _: &AppContext) -> KeymapContext {
Self::default_keymap_context()
}
}
impl ViewId {