diff --git a/src/entities/attribute.rs b/src/entities/attribute.rs index bb8bded87..75a81cf64 100644 --- a/src/entities/attribute.rs +++ b/src/entities/attribute.rs @@ -235,9 +235,14 @@ fn build_attr_truck(input: AttrTextInputs<'_>, document: &acadrust::CadDocument) .split('\n') .map(|l| l.to_string()) .collect(); - // Tag-style fallback when there is no value (ATTDEF preview style). + // An empty attribute value renders nothing — matching AutoCAD, where a + // filled-in INSERT attribute left blank shows no text. The old `[value]` + // fallback only ever fired when the value was already empty (and never + // carried the tag), so it drew stray "[]" brackets for every blank + // attribute. An ATTDEF preview passes its tag as the value (non-empty), so + // it never reached this branch and is unaffected. let lines: Vec = if plain.iter().all(|l| l.is_empty()) { - vec![format!("[{}]", input.value)] + Vec::new() } else { plain }; @@ -329,8 +334,10 @@ fn build_attr_truck(input: AttrTextInputs<'_>, document: &acadrust::CadDocument) impl TruckConvertible for AttributeDefinition { fn to_truck(&self, document: &acadrust::CadDocument) -> Option { + // An attribute definition previews its tag when it has no default + // value, so the placeholder is visible where a block will prompt for + // input. (Passed as a non-empty value, so it renders as-is.) let display_value = if self.default_value.is_empty() { - // tag-only preview path: build_attr_truck wraps in brackets. self.tag.clone() } else { self.default_value.clone()