# fix\(web\): survive WebKit table quirks, selection run splits, late fonts · stienswout/t3code

[View on GitCafe](https://git.cafe/stienswout/t3code/commit/b72cc87c3e04c0c8c3b2778b5569fc4a1db71a74)

Repository: [stienswout/t3code](https://git.cafe/stienswout/t3code)

Visibility: public

Requested revision: b72cc87c3e04c0c8c3b2778b5569fc4a1db71a74

Requested commit: b72cc87c3e04c0c8c3b2778b5569fc4a1db71a74

Commit: b72cc87c3e04c0c8c3b2778b5569fc4a1db71a74

Tree: fcc33fa68f5d8bbcb82555cb82171c622ad345b7

Author: Wout Stiens

Committer: Wout Stiens

## Message

```
fix(web): survive WebKit table quirks, selection run splits, late fonts

Three renderer reliability fixes:

- Register the write-PTY trampoline with table.grow(1) + table.set
  instead of a grow init value: WebKit stores the init value with broken
  type information and every later call_indirect through it traps with a
  signature mismatch, which killed the surface on the first terminal
  reply (resize size reports made it look like resizing broke the
  terminal: cleared canvas, dead render loop, lost focus). Verified with
  an isolated WebKit probe: grow-init traps, grow-then-set delivers.

- Selection no longer splits text runs: since selection tints only the
  background overlay, splitting runs at selection edges just shifted
  glyph spacing whenever the face's true advance differed from the
  measured cell width.

- Re-measure cell metrics when document.fonts finishes loading faces:
  a cold load could measure the grid from a fallback font and render
  with the real one, producing wrong advances and a cursor detached
  from the text. The surface now refits itself when the loaded faces
  change the measurement.

End-to-end verified in WebKit against the dev server: typing after
resize, drag selection with the action menu, no page errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

```

## Parents

- [6a31d5e12a861740b700802c86b5822e3a5d37f6](https://git.cafe/stienswout/t3code/commit/6a31d5e12a861740b700802c86b5822e3a5d37f6?format=markdown)

[Source at this commit](https://git.cafe/stienswout/t3code/tree/b72cc87c3e04c0c8c3b2778b5569fc4a1db71a74?format=markdown)
