Skip to content

Keep table widths synchronized during and after window resize - #152

Open
YishenTu wants to merge 3 commits into
nodes-app:mainfrom
YishenTu:fix/live-table-resize
Open

Keep table widths synchronized during and after window resize#152
YishenTu wants to merge 3 commits into
nodes-app:mainfrom
YishenTu:fix/live-table-resize

Conversation

@YishenTu

@YishenTu YishenTu commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Rendered tables could retain an old width during window resizing because AppKit's nested event-tracking loop did not reliably service deferred restyles. This change completes table reflow synchronously during live resize by default and lets embedders defer that work until release with rendersTablesDuringLiveResize = false.

With deferred rendering enabled, table images stay unchanged during the drag and reflow when resize ends, without a debounce delay. A final width delivered later by SwiftUI hosting still updates synchronously when it arrives.

Implementation

  • Track live-resize state at the scroll-view boundary and complete table raster, attribute, height, and overlay updates together.
  • Preserve per-run-loop coalescing for ordinary width changes. Deferred mode also holds callbacks queued before a live resize began.
  • Keep post-resize synchronization armed while clip, document, and text-view widths show an unconsumed hosting-layout mismatch.
  • Preserve exact fractional geometry, text insets, fixed reading-column ownership, document height, and wide-table overlay sizing.
  • Limit width-change restyling to indexed table paragraphs.

Validation

  • swift test --arch arm64: 492 tests passed across 68 suites, including 22 table-width tests.
  • Native AppKit/TextKit coverage includes intermediate and final widths, late hosting layout, fractional widths, multiple tables, height changes, and wide overlays.
  • New regressions verify unchanged table images throughout deferred dragging, synchronous final reflow, queued callbacks, and preserved source and selection.
  • DarthScriptum integration: 22 focused resize and compatibility tests passed with the published engine revision; manual shrink/widen checks passed on the installed app.

Trade-off

The default behavior synchronously renders tables during each physical resize callback. Embedders that prioritize drag responsiveness can disable live table rendering; table images then retain their previous geometry until release. Both modes preserve immediate final-width synchronization.

Apply width-dependent table styling before each physical resize callback returns, while coalescing ordinary width writes. Track fractional geometry, trailing hosted layout propagation, document height, and wide-table overlays with real AppKit regression coverage.
@YishenTu
YishenTu force-pushed the fix/live-table-resize branch from c1982a9 to 9e05936 Compare August 13, 2026 05:04
@YishenTu YishenTu changed the title Keep rendered tables in sync during live resize Keep table widths synchronized during and after window resize Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant