Recompute table formulas after an edit

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-06 16:34:00 +03:00
1 parent f297b35e4a
commit 8f3e99b03e
4 files changed
+13 -2

No files matched your search

+10
View File
@@ -110,6 +110,16 @@ pub fn update_fields(
document.update_fields(&OcsFieldContext(Some(&snapshot)), event, hosts)
}
/// Recompute a table's cell formulas into its block after the table changed;
/// returns the cell texts that changed.
pub fn refresh_table_formulas(document: &mut CadDocument, table: Handle) -> Vec<Handle> {
if document.fields.is_empty() {
return Vec::new();
}
let snapshot = document.clone();
document.refresh_table_formulas(&OcsFieldContext(Some(&snapshot)), table)
}
/// The text a table cell shows for its field: a formula is evaluated live
/// (it reads other cells), any other field shows its stored value.
pub fn cell_text(document: &CadDocument, field: Handle, table: Handle) -> Option<String> {
+1
View File
@@ -3632,6 +3632,7 @@ impl Scene {
&& matches!(self.document.get_entity(*handle), Some(EntityType::Table(t)) if t.block_record_handle.is_none())
{
rebuilt_table_block |= self.document.refresh_table_block(*handle);
rebuilt_table_block |= !crate::entities::field::refresh_table_formulas(&mut self.document, *handle).is_empty();
}
}
if rebuilt_table_block {