From 470d6a6b7fba0937aacf089a8c3de68e651198bb Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Tue, 6 Oct 2026 16:06:21 +0300 Subject: [PATCH] Rebuild a table's block after an edit Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/scene/mod.rs | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 063cfe1d8..157c7c2e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4206,7 +4206,7 @@ dependencies = [ [[package]] name = "opencadcodec" version = "0.5.5" -source = "git+https://github.com/ramox81/cadcodec.git?rev=24bdac7#24bdac79787a8196227c43cc840277f302e7e124" +source = "git+https://github.com/ramox81/cadcodec.git?rev=87de138#87de1388d5884cb712c24ad407159e45b08df84a" dependencies = [ "ahash 0.8.12", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 1ac2ede73..a36c7242f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aa iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" } [patch."https://github.com/HakanSeven12/opencadcodec.git"] -opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "24bdac7" } +opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "87de138" } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] getrandom = "0.3" diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 97c3d857d..ee686acc3 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -3624,6 +3624,19 @@ 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); + } + } + 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); }