diff --git a/crates/engine/src/cmd/vector_cmds/line_tool_history_name_tests.rs b/crates/engine/src/cmd/vector_cmds/line_tool_history_name_tests.rs index 5f2493c86e3..7ac97698fb7 100644 --- a/crates/engine/src/cmd/vector_cmds/line_tool_history_name_tests.rs +++ b/crates/engine/src/cmd/vector_cmds/line_tool_history_name_tests.rs @@ -108,7 +108,7 @@ fn a_bad_label_for_a_shape_add_preserves_the_document_and_history() { let id = s.execute("shape.create", line(None)).unwrap()["layer"].as_u64().unwrap(); let n = steps(&s); let before = s.active().unwrap().doc.clone(); - let mut params = line(Some("Ellipse Tool")); + let mut params = line(Some("Unknown Tool")); params["addTo"] = json!(id); assert!(s.execute("shape.create", params).is_err()); assert_eq!(steps(&s), n); diff --git a/crates/engine/src/cmd/vector_cmds/shape.rs b/crates/engine/src/cmd/vector_cmds/shape.rs index a2afad58770..9d59ac44c55 100644 --- a/crates/engine/src/cmd/vector_cmds/shape.rs +++ b/crates/engine/src/cmd/vector_cmds/shape.rs @@ -436,7 +436,7 @@ fn default_name(kind: &str) -> &'static str { } /// Creates a shape layer, or adds path components to the shape identified by `addTo`. -/// A tool's optional History name applies to either edit. +/// Line Tool additions keep the tool's History name. Other shape additions use Add Shape. pub(super) fn shape_create(s: &mut Session, p: &Value) -> Result { const CMD: &str = "shape.create"; let add_to = p.get("addTo").and_then(Value::as_u64); @@ -456,6 +456,7 @@ pub(super) fn shape_create(s: &mut Session, p: &Value) -> Result { if let Some(target) = add_to { let op = p.get("op").and_then(Value::as_str).map_or(Some(PathOp::Combine), op_from).ok_or_else(|| bad(CMD, "unknown `op`"))?; let id = LayerId(target); + let label = if kind == "line" && label == "Line Tool" { label } else { "Add Shape" }; with_shape(s, id, label, |sh, _| { for mut sp in path.subpaths { // A joined subpath (a hole) belongs to the component before it, which takes `op`.