Skip to content

Search match counter does not reset properly when switching files #3361

Open
@kammeows

Description

@kammeows

p5.js version

1.11.1

What is your operating system?

Windows

Web browser and version

132.0.6834.160

Actual Behavior

When switching between files in the p5.js Web Editor, the search match counter does not reset. The counter continues displaying results from the previously opened file instead of updating to reflect matches in the new file.

Because of this, it shows wrong values of matched words (if any).

In the following image, I have one hello written in sketch.js:

Image

I switch to index.html, which has 2 hellos written, but the counter doesn't update to 2 and instead shows a wrong value:

Image

And if I type 2 more hellos, it still doesn't update correctly:

Image

Once I switch back to sketch.js, it shows previous count, which again is a wrong behavior:

Image

Expected Behavior

  • When a user switches files, the search match counter should reset and update based on the newly opened file.
  • If the new file contains matching search terms, the counter should reflect the correct number of matches.
  • If no matches are found, the UI should display "No results".

Steps to reproduce

Steps:

  1. Open a file, write hello (only once)
  2. Click on ctrl+F to open the search dialog and search for the word hello. The search counter should display the correct number of matches.
  3. Switch to another file, which has a different number of matches for "hello".
  4. Observe the search match counter—it still displays the count from previous, instead of resetting.

Activity

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

    Area:EditorFor CodeMirror-related featuresBug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions