You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: File find leaves the active match below the viewport when word wrap is on #39608
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
Turn on word wrap (Settings > Appearance > Word wrap).
In the right panel Files surface, open a long file where many lines above the target wrap to several visual rows. My file was a ~3000-line JSON tool catalog whose "description" values wrap to 3 to 6 rows each.
Press Ctrl+F and search for a string that only matches far down the file, e.g. maximum": 25 (matches on lines ~2400 to 2790).
Press Enter to step through the matches.
Expected behavior
Each match, including the active one ("3 of 3"), scrolls into view.
Actual behavior
The find bar shows "3 of 3", but the viewport stops short of the match. In my case the last visible line was 2742 and the active match was on line 2790, about 48 logical lines (roughly one screen) below the viewport. Scrolling down by hand shows the highlighted match. This happens often with wrapped files, and the gap appears to grow with the number of wrapped lines above the match.
My guess at the cause: the scroll target for the active match is computed from estimated (single-row) line heights in the @pierre/diffsVirtualizer used by FilePreviewPanel.tsx, before the wrapped rows between the viewport and the match have been measured. That would also explain why the error is always short of the match. #7907 described a similar stale-height problem for caret reveal after Enter with word wrap on.
With word wrap turned off, the same search scrolls correctly and the match is shown, so word wrap is required to reproduce.
Impact
Minor bug or occasional failure
Version or commit
0.1.10 (server); desktop app on Windows, project hosted in WSL
Environment
Windows desktop app connected to a WSL backend, Files panel in the right sidebar, word wrap on.
Activity