0
votes

I want to recreate the find function in CodeMirror for highlight each occurrence like showed in this demo.

I have created an example using marks, but highlight only the first occurrence. http://jsfiddle.net/oxmgm4sd/

1

1 Answers

1
votes

Changing your if (cursor.findNext()) to while (cursor.findNext()) might already get you somewhere. It is more efficient (though also a little more complicated) to use an overlay instead, which is what the built-in search functionality does.