diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 12:38:32 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 12:38:32 +0300 |
| commit | 4c72f7b02fbafd15d0cf843edece106714bcc5f7 (patch) | |
| tree | ad5bdc869fd00cdb05d62eda4404586403382ce8 /docs/correctness-audit.md | |
| parent | 5f03033b0e211f9ed13e7a1351f9a8f9011ab665 (diff) | |
Keep the snapshot unchanged when an update fails
term_snapshot_update converted the viewport in place, so an allocation
that failed midway left the snapshot empty and a renderer painted a blank
frame. Split the update into two phases. Phase 1 makes every allocation
the update needs and counts the arena words the converted rows add, then
grows the arena once. Phase 2 writes the view, cells, keys, clusters, and
selection, and cannot fail. A failed update now keeps the previous
content, and a retry is an ordinary incremental update.
invalidate() is removed. The term_snapshot_update comment and the
correctness audit now say the snapshot keeps its previous content.
The failure test fails each allocation in turn from the same starting
state. After every failed call it compares the view, cells, row keys,
selection spans, and cluster code points with the state before the call.
A retry must succeed and match a fresh capture. The cases are a first
update, a 32 by 16 screen of ZWJ families and regional-indicator flags
(arena growth), a resize, a 300-row screen (scratch arrays), and a long
scroll run.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/correctness-audit.md')
| -rw-r--r-- | docs/correctness-audit.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/correctness-audit.md b/docs/correctness-audit.md index 4c9a14c..dd854a1 100644 --- a/docs/correctness-audit.md +++ b/docs/correctness-audit.md @@ -96,8 +96,9 @@ remain on row 3, and history should remain empty. - Snapshot scroll accounting now counts discarded cluster records as dead, allowing compaction to reclaim them. -- Snapshot allocation failures now report false, empty the snapshot, and - force a complete capture on retry. +- Snapshot allocation failures now report false and leave the previous + snapshot unchanged. Every allocation happens before a field changes, so a + retry is an ordinary incremental update. - Height shrink allocates the replacement screen before moving rows or changing the cursor, preserving state if allocation fails. |
