Skip to content

[BUG] Incorrect highlight of search result when viewing file history #757

@wenfangdu

Description

@wenfangdu

Describe the Bug

image

Faulty code:

let fileName = this.props.committedFile.relativePath;
if (fileName.lastIndexOf('/') != -1) {
fileName = fileName.substr(fileName.lastIndexOf('/') + 1);
}
const fileNameClass = fileName == globalThis.fileName ? 'file-name-active' : 'file-name';

Steps To Reproduce

File structure:
-src/index.tsx
-eva/index.tsx

  1. Make changes to the above files and commit them
  2. Open src/index.tsx
  3. Use git.viewFileHistory
  4. Select the commit just made and search for "index"
  5. Both src/index.tsx and eva/index.tsx are highlighted

Expected Behavior

Only src/index.tsx should be highlighted.

Environment

  • OS: macOS 14
  • VSCode version: 1.85.1
  • Git History version: 0.6.20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions