fix(canvas): seed an empty paragraph when pouring text into a fresh cell#3
Merged
Conversation
… cell A table cell created by `insertTable` carries ZERO paragraphs. The first text pour into it (the paged.sheet cell pour) located the end of an empty stream — `locate` pins an empty `paragraphs` to `paragraph_idx 0` via `saturating_sub(1)` — and `insert_one_segment` then indexed `paragraphs[0]` on an empty slice, panicking with `index out of bounds: the len is 0 but the index is 0` (mutate.rs:264). The panic poisoned the wasm, so every later call failed with the wasm-bindgen "recursive use of an object" guard — a wall of errors that masked the real cause. `apply_insert_text` now seeds one empty `Paragraph` when the resolved cell (or any) paragraph stream is empty, so the first write has a stream to land in. Tests: a new cell_text regression (insertTable → insertText into the fresh empty cell does not panic) + a tablecell_wire pin of the cell-pour op shapes. Co-Authored-By: Dietmar Rietsch <dietmar.rietsch@andthenext.at> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pouring text into a freshly-created, empty table cell panicked with
index out of bounds: len 0 index 0—apply_insert_textassumed the cell's text stream already had at least one paragraph.Fix
apply_insert_textseeds an emptyParagraphwhen the cell stream is empty, so the first insert into a new cell lands cleanly.This is one half of the native-table cell-pour fix. It must merge together with
plugin-sheets#fix/tablecell-id— that bundle's new two-lanepourCellContent()would panic against an unpatched core. Do not publish one without the other.🤖 Generated with Claude Code