Commit Graph
2 Commits
Author SHA1 Message Date
finley08 b0d354f209 fix(editor): re-measure a revealed editor even when its host is only MOVED
The native right sidebar parks a `keepMounted` tab body through the host's
`retainTab` path, which moves the body into a hidden seat and back. Moving a
node never changes its border box, so the `ResizeObserver` added in #837
(d3df20e / db563ca) is never called for that path: a CodeMirror view created
while its host was hidden keeps the zero-sized viewport it measured, and the
editor stays visually blank — gutter line numbers drawn, document body empty —
until the tab is remounted. Observed on DSH 0.2.0-rc.2 + the Electron shell
with a `.yaml` file opened from the file tree while another tab was active: the
buffer holds the text (select-all copies it), only the paint is missing.

Three additive recoveries, next to the existing measure:

- `IntersectionObserver` on the host — reports the reveal itself, so a body
  that was merely moved is re-measured (the box need not change).
- a `requestAnimationFrame` follow-up after mount — a reveal that lands in the
  mount's own frame happens after CodeMirror's first measure read a zero box.
- `visibilitychange` / `window resize` — the document-level equivalents.

A non-intersecting report spends nothing, so pane scrolling does not queue
measures. `tests/text-editor-visibility.spec.tsx` gains a case for the
size-preserving reveal (and pins that the invisible report is ignored); the
existing ResizeObserver cases are unchanged.
2026-10-08 08:14:34 +08:00
LE Quoc Dat db563ca76c fix(editor): remeasure parked CodeMirror views 2026-10-03 20:54:00 +00:00