From 24ce89e0fc44db9eb895c515561b89b39a928a9c Mon Sep 17 00:00:00 2001 From: leValdemar19 Date: Sat, 31 Oct 2026 13:35:33 +0000 Subject: [PATCH] =?UTF-8?q?Modify=20=E2=96=B8=20Delete=20with=20nothing=20?= =?UTF-8?q?selected=20asks=20for=20a=20pick=20instead=20of=20a=20parameter?= =?UTF-8?q?=20error=20(#9079)=20(#9114)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * claim: #9079 * Modify ▸ Delete with nothing selected asks for a pick instead of a parameter error (#9079) Starting `timeline.delete` from the ribbon, the command palette or the control channel ran it with no parameters, so the notice showed the engine's check ("`features` must list features, or `groups` timeline folders"). It now deletes what is selected, as the Delete key does, and with nothing selected shows a hint saying what to pick, changing nothing. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .../locales/pending/delete-select-first.json | 10 ++++++++++ crates/ui-egui/src/delete.rs | 5 +++++ crates/ui-egui/src/lib.rs | 10 ++++++++++ crates/ui-egui/src/menu_tests.rs | 20 +++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 assets/locales/pending/delete-select-first.json diff --git a/assets/locales/pending/delete-select-first.json b/assets/locales/pending/delete-select-first.json new file mode 100644 index 000000000..c52abbc5b --- /dev/null +++ b/assets/locales/pending/delete-select-first.json @@ -0,0 +1,10 @@ +{ + "en": { "ui.delete_select_first": "Select what to delete first: features, bodies, components or sketch geometry" }, + "ar": { "ui.delete_select_first": "حدّد أولاً ما تريد حذفه: الميزات أو الأجسام أو المكونات أو هندسة الرسم" }, + "de": { "ui.delete_select_first": "Wählen Sie zuerst aus, was gelöscht werden soll: Features, Körper, Komponenten oder Skizzengeometrie" }, + "he": { "ui.delete_select_first": "בחרו קודם מה למחוק: תכונות, גופים, רכיבים או גאומטריית סקיצה" }, + "ja": { "ui.delete_select_first": "先に削除するものを選択してください: フィーチャ、ボディ、コンポーネント、スケッチ ジオメトリ" }, + "ko": { "ui.delete_select_first": "먼저 삭제할 항목을 선택하세요: 피처, 바디, 컴포넌트 또는 스케치 형상" }, + "vi": { "ui.delete_select_first": "Hãy chọn trước những gì cần xóa: tính năng, khối, thành phần hoặc hình học phác thảo" }, + "zh": { "ui.delete_select_first": "请先选择要删除的内容:特征、实体、组件或草图几何" } +} diff --git a/crates/ui-egui/src/delete.rs b/crates/ui-egui/src/delete.rs index ac35f4109..6b626fc9b 100644 --- a/crates/ui-egui/src/delete.rs +++ b/crates/ui-egui/src/delete.rs @@ -71,6 +71,11 @@ pub fn delete_selection(app: &mut SolveApp) { request(app, params); } +/// Whether Delete has nothing to act on: nothing selected, and no joint open in Edit Joint. +pub fn nothing_to_delete(app: &SolveApp) -> bool { + is_empty(&selection_params(app)) && edited_joint(app).is_none() +} + /// The joint the open Edit Joint dialog edits. fn edited_joint(app: &SolveApp) -> Option { match app.dialog.as_ref().map(|d| &d.kind) { diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index a73479ff8..f330b4010 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -1533,6 +1533,16 @@ impl SolveApp { self.repeat_last(); return; } + // Modify ▸ Delete deletes what is selected, as the Delete key does (#9079); with nothing + // selected it says what to pick instead of running with no features. + if id == "timeline.delete" { + if delete::nothing_to_delete(self) && self.tree.picked_timeline_groups.is_empty() { + self.set_status(self.tr("ui.delete_select_first"), false); + } else if !timeline_left::delete_selected_folders(self) { + delete::delete_selection(self); + } + return; + } // Front … Isometric (Ctrl+1…7 by default) turn the view as the view cube's faces do. The // flat pattern is a 2D page: it has no other side to turn to. if solidcraft_engine::standard_view(id).is_some() { diff --git a/crates/ui-egui/src/menu_tests.rs b/crates/ui-egui/src/menu_tests.rs index f52ff5e95..50c819cf4 100644 --- a/crates/ui-egui/src/menu_tests.rs +++ b/crates/ui-egui/src/menu_tests.rs @@ -673,6 +673,26 @@ fn delete_key_handles_every_kind_and_asks_about_dependents() { assert_eq!(app.session.doc.features.len(), n); } +/// #9079: Modify ▸ Delete with nothing selected says what to pick, not the command's parameter +/// error, and changes nothing; with something selected it deletes it, as the Delete key does. +#[test] +fn modify_delete_with_nothing_selected_asks_for_a_pick() { + let mut app = SolveApp::new(Session::default(), Services::default()); + app.run("solid.box", json!({"length": 10, "width": 10, "height": 10, "body_name": "Box"})).unwrap(); + app.run("construct.plane.offset", json!({"base": "XY", "offset": 10})).unwrap(); + let n = app.session.doc.features.len(); + app.run("select.clear", json!({})).unwrap(); + app.start("timeline.delete"); + let (message, _, error) = app.status.clone().expect("a hint"); + assert!(!error && message == app.tr("ui.delete_select_first"), "{message:?} error: {error}"); + assert!(!message.contains('`'), "no parameter names: {message}"); + assert_eq!(app.session.doc.features.len(), n, "nothing deleted"); + app.run("select.set", json!({"items": [{"type": "plane", "name": "Plane1"}]})).unwrap(); + app.start("timeline.delete"); + assert!(app.session.doc.find_feature("Plane1").is_none(), "the selection goes"); + assert_eq!(app.session.doc.features.len(), n - 1); +} + #[test] fn browser_feature_menu_deletes_its_target_and_supports_undo() { let mut app = SolveApp::new(Session::default(), Services::default());