From d0dbf8e1e269ae46ae456cf2485b70011134b8b7 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 15 Dec 2023 11:59:06 -0700 Subject: [PATCH] Fix bug where vim commands were copied on each update_matches In zed1, the array of commands was recalculated on every update_matches, In zed2 it's cached before we change the focus. --- crates/command_palette2/src/command_palette.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/command_palette2/src/command_palette.rs b/crates/command_palette2/src/command_palette.rs index 393fb16f81..04efe1df53 100644 --- a/crates/command_palette2/src/command_palette.rs +++ b/crates/command_palette2/src/command_palette.rs @@ -101,6 +101,7 @@ pub struct CommandInterceptResult { pub struct CommandPaletteDelegate { command_palette: WeakView, + all_commands: Vec, commands: Vec, matches: Vec, selected_ix: usize, @@ -135,6 +136,7 @@ impl CommandPaletteDelegate { ) -> Self { Self { command_palette, + all_commands: commands.clone(), matches: vec![], commands, selected_ix: 0, @@ -167,7 +169,7 @@ impl PickerDelegate for CommandPaletteDelegate { query: String, cx: &mut ViewContext>, ) -> gpui::Task<()> { - let mut commands = self.commands.clone(); + let mut commands = self.all_commands.clone(); cx.spawn(move |picker, mut cx| async move { cx.read_global::(|hit_counts, _| {