DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Docking: Preflight Panel… keeps an open Preflight flyout; search leaves out unavailable and alias docking commands
aiongg70d5149ba677
diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rsindex cbcfb13cd..a46ad2558 100644--- a/crates/ui-egui/src/chrome.rs+++ b/crates/ui-egui/src/chrome.rs@@ -1095,9 +1095,11 @@ pub fn doc_tabs(app: &mut DesignApp, ui: &mut egui::Ui) {}}-/// Show the Preflight panel.+/// Show the Preflight panel. An open Preflight flyout stays: `window.panel` would close it.fn show_preflight(app: &mut DesignApp) {- if let Err(e) = app.run("window.panel", json!({"panel": "preflight"})) {+ if app.ui.docking_flyout.as_deref() != Some("preflight")+ && let Err(e) = app.run("window.panel", json!({"panel": "preflight"}))+ {app.status(e);}}diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex 0d4f0a78d..fee463311 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -3408,9 +3408,23 @@ fn quick_commands() -> impl Iterator<Item = (&'static str, &'static str, Option<.iter().filter(|c| !c.menu.is_empty() || c.shortcut.is_some()).map(|c| (c.id, c.label, c.shortcut))- .chain(UI_COMMANDS.iter().map(|c| (c.0, c.1, c.2)))+ .chain(UI_COMMANDS.iter().filter(|c| !NOT_SEARCHED.contains(&c.0)).map(|c| (c.0, c.1, c.2)))}+/// UI commands Quick Apply and the menu search leave out: the shared docking commands+/// DesignCraft does not provide, and the older ids that share a label with a `window.panel.*` or+/// `window.workspace.*` command.+const NOT_SEARCHED: &[&str] = &[+ "window.panel.window",+ "window.workspace.lock",+ "window.floatPanel",+ "window.dockPanel",+ "window.collapseToIcons",+ "ui.dock",+ "ui.dock.reset",+ "window.resetWorkspace",+];+/// Whether any of `texts` contains the lowercased query (an empty query matches everything).fn quick_match(query_lower: &str, texts: &[&str]) -> bool {query_lower.is_empty() || texts.iter().any(|t| t.to_lowercase().contains(query_lower))@@ -6162,6 +6176,20 @@ mod tests {assert!(app.ui.dialog.is_some(), "clicking the empty end of the Preferences… row must choose it");}+ /// Quick Apply and the menu search list no unavailable docking command and no label twice+ /// among the UI commands.+ #[test]+ fn searched_ui_commands_are_available_and_named_once() {+ let ui_ids: Vec<&str> = UI_COMMANDS.iter().map(|c| c.0).collect();+ let searched: Vec<(&str, &str)> = quick_commands().filter(|c| ui_ids.contains(&c.0)).map(|c| (c.0, c.1)).collect();+ assert!(!searched.iter().any(|c| matches!(c.0, "window.panel.window" | "window.workspace.lock")), "{searched:?}");+ let mut labels: Vec<&str> = searched.iter().map(|c| c.1).collect();+ labels.sort_unstable();+ let before = labels.len();+ labels.dedup();+ assert_eq!(labels.len(), before, "a label twice: {searched:?}");+ }+/// Keys a floating panel's own OS window left over run the main window's tool shortcuts,/// Escape and the active tool's keys.#[test]