forked from 1b-agent/opencadstudio-upstream
review(#1630): one table rebuild loop that also refreshes formulas; one cell layout
- main already rebuilt an edited table's block; the PR added a second loop after it that could never fire. Formula refresh and the block cache bump now live in the one loop. - Formula refresh copies the drawing only for a table that has a field. - A field cell lays its text out once and boxes it from those cells. - A zero text height at one level falls through to the next instead of ending the lookup. - Field box constants and BACKGROUND keep their own doc comments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
95d5eb73d9
commit
62d72b3a8d
3 files changed
+34
-41
No files matched your search
+9
-15
@@ -3617,7 +3617,9 @@ impl Scene {
|
||||
// (the *T block) redrawn from the cells. Tables keeping their picture
|
||||
// (moved, restyled, opened from a file) are never redrawn: the block
|
||||
// may hold authored content the redraw does not reproduce.
|
||||
// Its cell formulas are worked out again into that block.
|
||||
if !appearance_only {
|
||||
let mut rebuilt = false;
|
||||
for (handle, kind) in &changes {
|
||||
if !matches!(kind, ChangeKind::Removed)
|
||||
&& matches!(
|
||||
@@ -3625,9 +3627,15 @@ impl Scene {
|
||||
Some(EntityType::Table(t)) if t.block_record_handle.is_none()
|
||||
)
|
||||
{
|
||||
self.document.refresh_table_block(*handle);
|
||||
rebuilt |= self.document.refresh_table_block(*handle);
|
||||
rebuilt |= !crate::entities::field::refresh_table_formulas(&mut self.document, *handle)
|
||||
.is_empty();
|
||||
}
|
||||
}
|
||||
// The block's cached drawing is stale once its texts change.
|
||||
if rebuilt {
|
||||
self.block_epoch = GEOMETRY_EPOCH.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
// A restyle (layer on/off, colour, text or dimension style) moves no
|
||||
// geometry, so nothing measured from it is re-resolved: an
|
||||
@@ -3695,20 +3703,6 @@ impl Scene {
|
||||
}
|
||||
}
|
||||
}
|
||||
// An edited table lets go of its block; rebuild it from the cells so
|
||||
// the drawing shows and saves the cell texts and grid it now holds.
|
||||
let mut rebuilt_table_block = false;
|
||||
for (handle, kind) in &changes {
|
||||
if !matches!(kind, ChangeKind::Removed)
|
||||
&& 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 {
|
||||
self.block_epoch = GEOMETRY_EPOCH.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
if !changes.is_empty() {
|
||||
self.refresh_dependency_index_for_changes(&changes);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user