mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00

Extracted from #3110 Initial fix is relatively basic, and catching it with a test only required a little bit of extra scrutiny of the cursor state after one of the tests that we already had. However, the fix revealed faulty dirty tracking logic throughout the `cursorScrollAbove` function (and therefore bad results that were being tested for when they should not have been). I've ended up clarifying things, fixing the asserted dirty states in all the `cursorScrollAbove` tests, and then finally implementing another very trivial fix that catches the mistake. Fixing the dirty tracking is really just an exercise in correctness though, since when the scroll happens it inherently invalidates the viewport, and therefore will trigger a full rebuild in the renderer... unless, I guess, another operation is performed that cancels things out and results in the viewport pin being in the same place as the previous render, but that seems an exceptionally difficult scenario to make happen on purpose much less accidentally. This PR is almost entirely changes to comments and tests, there are only 2 lines of real code it changes, the one added to the start of `cursorScrollAbove` and the one modified at the start of `cursorScrollAboveRotate`. I believe these changes are entirely safe. (I wonder if they might have a bad effect on our `vtebench` scrolling performance though...)