Dialogs: a missing pick on OK is guidance, without Create Issue (#3292) (#6101)

Plane at Angle's OK with an empty Plane or Axis input showed "select a
plane first" or "pick an axis" as a red error with a Create Issue
button, and people filed it as a bug (#3292, #3773). A refusal that only
names what to pick is now shown as a plain hint, with no issue button,
in every dialog (Sketch Modify dialogs already hid it).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
semmelrinde
2026-10-25 01:25:06 +00:00
committed by GitHub
parent f06875128b
commit eef9a68809
+28 -1
View File
@@ -2197,6 +2197,11 @@ fn awaiting_selection(error: &str) -> bool {
error.get(..7).is_some_and(|start| start.eq_ignore_ascii_case("select "))
}
/// A dialog's refusal that names what to pick ("select the plane first", "pick an axis").
fn missing_pick(error: &str) -> bool {
awaiting_selection(error) || error.get(..5).is_some_and(|start| start.eq_ignore_ascii_case("pick "))
}
fn error_rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui: &mut egui::Ui) {
if matches!(d.kind, Kind::SketchModify(_))
&& d.previews()
@@ -2215,6 +2220,12 @@ fn error_rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui: &mut
if matches!(d.kind, Kind::SketchModify(_)) && awaiting_selection(&error) {
return;
}
// Other dialogs say so on OK ("select a plane first", "pick an axis"): that is what is
// left to pick, not a failure, so it is shown plainly, with no Create Issue (#3292, #3773).
if missing_pick(&error) {
crate::ui_kit::text(ui, &shown_error(&error), crate::ui_kit::Text::Hint("missing_pick"));
return;
}
ui.vertical(|ui| {
crate::ui_kit::text(ui, &shown_error(&error), crate::ui_kit::Text::Report("error", true));
let response = crate::ui_kit::button(ui, "Create Issue…", crate::ui_kit::Button::Normal);
@@ -5433,7 +5444,7 @@ fn face_point(x: &Sel) -> Option<Value> {
#[cfg(test)]
mod awaiting_selection_tests {
use super::awaiting_selection;
use super::{awaiting_selection, missing_pick};
#[test]
fn missing_selection_messages_are_guidance_and_real_failures_are_not() {
@@ -5448,6 +5459,22 @@ mod awaiting_selection_tests {
}
for failure in ["Offset distance must be positive", "the sketch has no curves", "Selection is not on this sketch", "", "sel"] {
assert!(!awaiting_selection(failure), "{failure}");
assert!(!missing_pick(failure), "{failure}");
}
assert!(missing_pick("pick an axis") && missing_pick("select a plane first") && !missing_pick("pickle"));
}
/// Plane at Angle's OK with nothing picked says what to pick, without the red error and its
/// Create Issue button that made people file it as a bug (#3292, #3773).
#[test]
fn a_missing_pick_is_guidance_without_an_issue_button() {
let mut h = crate::scenario::Harness::new();
h.step(&serde_json::json!({"start":"construct.plane.at_angle"})).unwrap();
h.frames(2);
h.step(&serde_json::json!({"key":"Enter"})).unwrap();
h.frames(2);
let d = h.app.dialog.as_ref().expect("the dialog stays open");
assert_eq!(d.error.as_deref(), Some("select a plane first"));
assert!(crate::scenario::handle_at("dialog:create_issue").is_none(), "no Create Issue for a missing pick");
}
}