Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Find in Files 'selected match' highlight shown on wrong match after editing text #8161

@peterflynn

Description

@peterflynn
  1. Do a Find in Files on a string that appears several times in one file
  2. Click the 2nd result
  3. Go to the top of the file and type in another match by hand (or copy/paste, or duplicate the line the 1st result is on, etc. -- anything that creates a new match earlier in the file)

Result: The 'selected match' highlight is now on (what used to be) the 1st result.

Expected: Highlight remains on the match you last clicked, (what used to be) the 2nd result.

If you delete an existing result instead in step 3, the highlight will be wrong in the opposite direction instead.

This is happening because the code that re-renders the results list after an edit just restores the selection highlight by table-row index.

Since this isn't a very important selection -- it's really just a marker for 'last clicked match' -- I suggest we just clear it whenever the number of matches has changed, rather than trying to do something fancy to restore it more correctly.

Note: This occurs on master, so it is not a result of the Replace In Files code changes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions