Modify ▸ Delete with nothing selected asks for a pick instead of a parameter error (#9079) (#9114)

* 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 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
leValdemar19
2026-10-31 13:35:33 +00:00
committed by GitHub
parent a476e645b0
commit 24ce89e0fc
4 changed files with 45 additions and 0 deletions
@@ -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": "请先选择要删除的内容:特征、实体、组件或草图几何" }
}
+5
View File
@@ -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<u64> {
match app.dialog.as_ref().map(|d| &d.kind) {
+10
View File
@@ -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() {
+20
View File
@@ -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());