Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

SearchCursor.matches() doesn't work properly if query is /.*/ #1155

@soswow

Description

@soswow

SearchCursor.matches used inside SearchCursor.find().
When you call .find() for the first time it returns first row, like

this.pos == {
  from: {ch: 0, line: 0}, 
  to: {ch: 18, line: 0},
  match: ["First row here"]
}

But when you ask .find() for the second time it returns

this.pos == {
  from: {ch: 18, line: 0}, 
  to: {ch: 18, line: 0},
  match: [""]
}

And all following calls will return the same output.
So if I use it in the client code like this (to find all matches for example):

var cursor = getSearchCursor(cm, state.query);
while (cursor.findNext()) {
  //Mark found item
}

Then I end pu with infinite loop on /.*/

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