From c626e770a036320e1c827c90d2182dc1ee541f6e Mon Sep 17 00:00:00 2001 From: Kevin Rubio <105080383+kevinru2023@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:37:22 -0800 Subject: [PATCH] outline_panel: Remove toggle expanded behavior from OpenSelectedEntry (#42214) Fixed outline panel space key behavior by removing duplicate toggle call The `open_selected_entry` function in `outline_panel.rs` was incorrectly calling `self.toggle_expanded(&selected_entry, window, cx)` in addition to its primary logic, causing the space key to both open/close entries AND toggle their expanded state. Removed the redundant `toggle_expanded` call to achieve the intended behavior. Closes #41711 Release Notes: - Fixed issue with the outline panel where pressing space would cause an open selected entry to collapse and cause a closed selected entry to open. --------- Co-authored-by: Smit Barmase --- crates/outline_panel/src/outline_panel.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index a7fe9ea679d565b2a8a2a26bf86306b93dd62e78..f44c6438ebd454d343a8ac49b0f6db11c11b469d 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -986,7 +986,6 @@ impl OutlinePanel { if self.filter_editor.focus_handle(cx).is_focused(window) { cx.propagate() } else if let Some(selected_entry) = self.selected_entry().cloned() { - self.toggle_expanded(&selected_entry, window, cx); self.scroll_editor_to_entry(&selected_entry, true, true, window, cx); } } @@ -5845,7 +5844,7 @@ mod tests { } #[gpui::test] - async fn test_multiple_workrees(cx: &mut TestAppContext) { + async fn test_multiple_worktrees(cx: &mut TestAppContext) { init_test(cx); let fs = FakeFs::new(cx.background_executor.clone()); @@ -5951,7 +5950,7 @@ two/ outline_panel.update_in(cx, |outline_panel, window, cx| { outline_panel.select_previous(&SelectPrevious, window, cx); - outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx); + outline_panel.collapse_selected_entry(&CollapseSelectedEntry, window, cx); }); cx.executor() .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100)); @@ -5977,7 +5976,7 @@ two/ outline_panel.update_in(cx, |outline_panel, window, cx| { outline_panel.select_next(&SelectNext, window, cx); - outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx); + outline_panel.collapse_selected_entry(&CollapseSelectedEntry, window, cx); }); cx.executor() .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100)); @@ -6000,7 +5999,7 @@ two/ <==== selected"#, }); outline_panel.update_in(cx, |outline_panel, window, cx| { - outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx); + outline_panel.expand_selected_entry(&ExpandSelectedEntry, window, cx); }); cx.executor() .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100)); @@ -7532,7 +7531,7 @@ outline: fn main()" cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx); + outline_panel.collapse_selected_entry(&CollapseSelectedEntry, window, cx); }); }); @@ -7564,7 +7563,7 @@ outline: fn main()" cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx); + outline_panel.expand_selected_entry(&ExpandSelectedEntry, window, cx); }); });