Skip to content

[Bug]: File find leaves the active match below the viewport when word wrap is on #39608

Closed

Description

@torerik81

Before submitting

  • 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

  1. Turn on word wrap (Settings > Appearance > Word wrap).
  2. 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.
  3. 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).
  4. 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/diffs Virtualizer 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions