From b64cc4eac6d787564fbd959a7fc543e5df5f779e Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 19 Oct 2026 13:30:02 +0000 Subject: [PATCH] docking: window.panel.minimize toggles an accordion entry both ways Without minimized the command read only dock and floating groups, so a closed accordion entry stayed closed. --- crates/ui/src/docking/command.rs | 9 ++++++++- crates/ui/src/docking/command_tests.rs | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/docking/command.rs b/crates/ui/src/docking/command.rs index 7a146f95..11a0a8df 100644 --- a/crates/ui/src/docking/command.rs +++ b/crates/ui/src/docking/command.rs @@ -426,7 +426,14 @@ impl DockCommand

{ Self::CloseOthers { panel } => one(Action::CloseOthers { panel: panel.clone() }), Self::Minimize { panel, minimized } => { let place = layout.place(panel).ok_or(DockError::MissingPanel)?; - let current = layout.group(&place).is_some_and(|g| g.minimized); + // An accordion entry is minimized while it is closed. + let current = match &place { + Place::Node(path) => match layout.root.as_ref().and_then(|root| super::dock_model::node_at(root, path)) { + Some(super::Node::Stack { entries }) => entries.iter().any(|e| &e.panel == panel && !e.open), + _ => false, + }, + place => layout.group(place).is_some_and(|g| g.minimized), + }; one(Action::SetMinimized { panel: panel.clone(), minimized: minimized.unwrap_or(!current) }) } Self::Iconic { panel, iconic } => { diff --git a/crates/ui/src/docking/command_tests.rs b/crates/ui/src/docking/command_tests.rs index 905e1452..307d8a86 100644 --- a/crates/ui/src/docking/command_tests.rs +++ b/crates/ui/src/docking/command_tests.rs @@ -381,3 +381,14 @@ fn dock_to_a_side_without_a_dock_takes_one_panel_out_of_a_shared_group() { assert_eq!(side("layers"), Some(Side::End)); assert_eq!(side("channels"), Some(Side::Start)); } + +#[test] +fn minimize_without_a_value_toggles_an_accordion_entry_both_ways() { + let entry = |panel: &str| StackEntry { panel: s(panel), open: true, height: None }; + let mut workspace = Workspace::new(Layout { root: Some(Node::Stack { entries: vec![entry("layers"), entry("history")] }), floating: Vec::new() }); + let toggle = parse(json!({"command": "window.panel.minimize", "panel": "layers"})).unwrap(); + toggle.apply(&mut workspace, false, &space(), permissions).unwrap(); + assert_eq!(workspace.layout.panel_state(&s("layers")), PanelState::Open); + toggle.apply(&mut workspace, false, &space(), permissions).unwrap(); + assert_eq!(workspace.layout.panel_state(&s("layers")), PanelState::Front); +}