fix(editor): prevent empty text commit from advancing command edit_count

- Propagates commit status out of inline editors so commands know whether a real change occurred.

- Fixes TEXTEDIT's Undo step rolling back unrelated document actions when the user presses OK on empty/cleared existing MText.
This commit is contained in:
Karim Jerbi committed 2026-06-18 17:55:30 +01:00
1 parent 8e48bf02a0
commit 02f70ab0b3
3 files changed
+12 -10

No files matched your search

+4 -3
View File
@@ -194,12 +194,12 @@ impl super::OpenCADStudio {
/// Commit the editor: create a new TEXT entity or update the edited slot.
/// Empty content drops a new entity and leaves an edited one untouched.
pub(super) fn text_inline_commit(&mut self) {
pub(super) fn text_inline_commit(&mut self) -> bool {
let i = self.active_tab;
let Some(ed) = self.text_inline.take() else { return };
let Some(ed) = self.text_inline.take() else { return false };
if ed.value.trim().is_empty() && ed.editing.is_none() {
self.refresh_properties();
return;
return false;
}
if let Some(h) = ed.editing {
self.push_undo_snapshot(i, "TEXT");
@@ -230,6 +230,7 @@ impl super::OpenCADStudio {
self.tabs[i].dirty = true;
}
self.refresh_properties();
true
}
/// Discard the editor without changing the drawing.