From 25bf371290c1576c5aaa0a03906be517be420751 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 16 Jun 2026 03:51:45 +0300 Subject: [PATCH] fix(menu): close the main menu when opening a recent file The recent-file buttons dispatched the open command without closing the app menu, so it stayed open over the loaded drawing. Use CloseAppMenuAndRun so the menu closes first, matching the other menu entries. Also commits the Cargo.lock update from dropping iced's debug feature. Fixes #103. Co-Authored-By: Claude Opus 4.8 --- Cargo.lock | 82 ---------------------------------------------- src/ui/app_menu.rs | 4 ++- 2 files changed, 3 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a249e288..86132e6fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2098,7 +2098,6 @@ checksum = "000e01026c93ba643f8357a3db3ada0e6555265a377f6f9291c472f6dd701fb3" dependencies = [ "iced_core", "iced_debug", - "iced_devtools", "iced_futures", "iced_renderer", "iced_runtime", @@ -2108,22 +2107,6 @@ dependencies = [ "thiserror 2.0.18", ] -[[package]] -name = "iced_beacon" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02a48f970444257a5e8b19def673f14f0d79c159fa851055e2a861683c3f8845" -dependencies = [ - "bincode", - "futures", - "iced_core", - "log", - "semver", - "serde", - "thiserror 2.0.18", - "tokio", -] - [[package]] name = "iced_core" version = "0.14.0" @@ -2137,7 +2120,6 @@ dependencies = [ "log", "num-traits", "rustc-hash 2.1.2", - "serde", "smol_str", "thiserror 2.0.18", "web-time", @@ -2149,24 +2131,11 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25035ab0215a620e53f4103e36fc4e59a1fb2817e4bfc38a30ad27b4202ea0be" dependencies = [ - "iced_beacon", "iced_core", "iced_futures", "log", ] -[[package]] -name = "iced_devtools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b8e2a306ac5c583234b02f5404afdb7b7467c8f72a4a44ad3e7be30fc4b339" -dependencies = [ - "iced_debug", - "iced_program", - "iced_widget", - "log", -] - [[package]] name = "iced_futures" version = "0.14.0" @@ -2978,17 +2947,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "mio" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" -dependencies = [ - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.61.2", -] - [[package]] name = "mmapio" version = "0.9.1" @@ -4816,10 +4774,6 @@ name = "semver" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" -dependencies = [ - "serde", - "serde_core", -] [[package]] name = "serde" @@ -5107,16 +5061,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - [[package]] name = "softbuffer" version = "0.4.8" @@ -5502,32 +5446,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "tokio" -version = "1.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "toml_datetime" version = "0.6.11" diff --git a/src/ui/app_menu.rs b/src/ui/app_menu.rs index 9095e99ca..4d9f8e560 100644 --- a/src/ui/app_menu.rs +++ b/src/ui/app_menu.rs @@ -396,7 +396,9 @@ fn recent_item_btn(path: &PathBuf) -> Element<'_, Message> { .align_y(iced::Center) .spacing(6), ) - .on_press(Message::Command(format!("OPEN_RECENT:{path_str}"))) + .on_press(Message::CloseAppMenuAndRun(format!( + "OPEN_RECENT:{path_str}" + ))) .style(|_: &Theme, status| button::Style { background: Some(Background::Color(match status { button::Status::Hovered => ITEM_HOVER,