m29 drags follow-up: a cancelled size's drag grid reaches the program; drag test on a manual clock

Merged
LA
14h ago
+107-18

Follow-up to #36631 (merged as 9511b2df1c8): the two non-blocking notes of its review, each fixed.

Why

  1. A drag grid whose size the presenter cancels never reached the program. During a drag, a terminal's grid for a size asked of Ghostty waits until the frame of that size lands. When the frame presenter cancelled that size instead (the terminal hidden, or moved out of its window, before the frame landed), the reporter kept only a flag, and the view's geometry already counted that grid as reported. The program kept an older grid until the next resize.
  2. The drag grid test slept in real time. DividerDragTerminalResizeCountTests slept 12 ms per drag frame so the 25 ms windows could close; a loaded runner stretches those sleeps.

Fix

  • TerminalGridReporter keeps the waiting grid itself (awaitingShown). Both cancel sites (place() for a hidden or windowless view, releaseFrameOwnership() on a window change) call shownCancelled(live:): the grid goes, coalesced while the drag is followed, else now. No one sees that size either way (the view is hidden or out of its window).
  • TerminalGridReporter(view:clock:) takes the coalescer's clock (ContinuousClock by default, as before). The count test gives each terminal's reporter one ManualClock and advances it 12 ms per drag frame.
  • TerminalSurfaceView keeps its base line count (god-type rule): two doc lines are shorter.

Changelog

  • none

Tests

RunRefStepResult
red: cancelled size (display)3210fea3e9e (test only)7fe83b635460da9d9ff15319queued
green: displayd7c6c5d149dfd8982d21b79f5612978e5bbqueued
green: 8 suites (manual-clock count test included)d7c6c5d149d6c3a5804dfc95e630975109cqueued
app buildd7c6c5d149d0122ae52a843465697b15f9bqueued

Note 2 changes no product behavior (the default clock is the one used before), so it has no behavioral red; the count test's own red and green stand from #36631 (10980491, 8fc86066).

Observed / Not run

  • Observed: prepush gate, check-no-godfiles.
  • Not run yet: the steps above; launch smoke.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes two non-blocking review notes from #36631: a drag grid whose size the presenter cancels now reaches the program, and drag resize count tests run on a manual clock instead of sleeping in real time.

Bug Fixes

  • TerminalGridReporter keeps the waiting grid itself (awaitingShown) rather than a flag. Both cancel sites — a hidden view in place() and a window change in releaseFrameOwnership() — call shownCancelled(live:), so the grid goes coalesced while the drag is followed, else now.
  • TerminalGridReporter(view:clock:) takes the coalescer's clock (ContinuousClock by default, unchanged behavior). DividerDragTerminalResizeCountTests now injects a ManualClock, advanced 12 ms per drag frame, so the coalescer's 25 ms windows close without real sleep.
  • Adds TerminalDragCancelledSizeGridTests, which hides a terminal's host while its drag size is in flight and asserts the program receives the grid it fits.