editor: Reuse display-map cursors when converting word diffs (#58658)

layout_word_diff_highlights converted each visible word diff to display
points via isomorphic_display_point_ranges_for_buffer_range, which walks
the inlay/fold/tab/wrap/block trees from the root on every call. With
many word diffs on screen this re-walks the same trees repeatedly each
frame.

Add a DisplayPointConverter that holds a forward-only cursor for each
display-map layer (mirroring the cursor reuse already done in
BlockMap::sync) so consecutive conversions amortize to near-constant
work. New forward cursors BufferOffsetToInlayPointCursor and
BlockPointCursor back the inlay and block layers; the fold/tab/wrap
layers reuse existing cursors. Each cursor gains a cheap reset() that
delegates to the underlying SumTree cursor; the converter resets its
cursors if an input range starts before the previous one ended, so it
stays correct for overlapping inputs (e.g. the base and buffer word
diffs of an inline modified hunk).

layout_word_diff_highlights now sorts the visible word diffs and feeds
them through a single converter.
isomorphic_display_point_ranges_for_buffer_range is reimplemented on top
of the converter to keep one code path.

Release Notes:

- Improved scrolling performance in diff views containing large hunks
489c880a58Lukas Wirth committed on 6/17/2026, 8:39:02 AM· committed by GitHubparent1722fe6
7 files changedLine totals unavailable