mirror of
https://github.com/penpot/penpot.git
synced 2026-11-20 09:00:49 +00:00
On the WebGL renderer, a sync re-measure of copies shared a 40 ms batch with user resizes of the main text. The batch skipped the component sync when any request asked for that. So a resize of the main (grow type, font size, paste, search and replace) often never reached copies on other pages or in other files, and the viewer and exports showed the old size. A batch now skips the sync only when every request asks for it, the same rule as :save-undo?. Such an edit costs one extra short sync round. That round holds only skip requests, so it stops after one pass. A copy that the sync switched from fixed to auto-grow was never re-measured, because the check read the grow type before the sync. The check now reads the grow type that the change sets. A copy that the sync makes fixed is not re-measured. A sync started without an undo group (library update dialog, color and typography sync) committed with a fresh group, and its re-measure and layout pass took other ones. Ctrl+Z first undid only the re-measure and left the copies in the old box. The sync now picks its group when it runs: inside an undo transaction (color, typography and asset deletes) it takes the transaction's, otherwise a fresh one. The re-measure and layout pass share it, so one undo reverts the edit, the sync and its follow-ups, and a failed save rolls them back together. On the SVG renderer, opening a page resized a copy with no position data even when its size had not drifted. Measured sizes round up, so 17.4 became 18. The measurement from that resize then landed on the user's last undo entry. The heal now reports whether it resized, and the check phase resizes only when the size drifted. The SVG page-open check covered only texts with overridden content. A copy loses its touched flags, so a label overridden inside a main (a Button label in a Card main) was never checked in the main's copies, and its heal skips the component sync. The check now covers every auto-grow text inside a copy, as the WebGL check does. The heal's reflow now skips the component sync too: without undo it touched the main component on every page open. A page-open check measured with a font that failed to load wrote the fallback font size. It now writes no size then; a copy without position data still gets it. The WebGL and SVG renderers can measure a text differently; a gap over 1 px makes each page open by a user of the other renderer write the size back. Two browsers on the SVG renderer can do the same: a long auto-width line can differ by more than 1 px, and an auto-height text can wrap a line differently. This is a known limit, noted in the text-heal docstring. The drift check moves to text-size-drifted? in app.common.geom.shapes.text, and takes a tolerance. Both renderers use it: 1 px for the SVG check and the WebGL page-open check, 0.1 px for the WebGL font-load check. The WebGL check did not skip axes that fill their layout parent, so those texts looked stale on every page open and were resized for nothing. It now reads the stored width and height and skips fill axes. The sync docstring and a test message gave the wrong reason for :skip-component-sync?. :ignore-touched stops the resize from marking :geometry-group. :skip-component-sync? stops the re-measure commit from starting another sync. "Remasure" is now "re-measure" in identifiers, test names and comments. The sync docstring now states that an auto-grow copy takes the main's size on each geometry sync, also with overridden content, until the re-measure or the page-open check corrects it. The sync's undo comment no longer says the layout pass gets the sync's undo group: the layout buffer drops it, and the pass joins the same undo entry through :stack-undo?. Tests: heal undo tests cover mixed user and sync batches in both orders, and undo for both renderers. A heal leaves the undo stack unchanged, and undo reverts the user edit. A heal reflow skips the component sync. Sync tests cover a copy that becomes auto-grow (re-measured) and one that becomes fixed (not), and a sync with no undo group that shares one with its re-measure, also inside an undo transaction, with and without a group of the edit. Viewport tests cover no resize without drift, a drifted copy that resizes and settles, the check of every auto-grow text in a copy, and no size write from a failed font. Component tests mount the SVG renderer: a drifted copy is measured once to check and once to settle, with no undo step, and a matching copy is measured once. Stale-selrect tests cover skipped fill axes. The drift tests move to common-tests.geom-shapes-text-test, with tolerance and grow-type cases. Relates to #12721 AI-assisted-by: claude-opus-5-5