Match highlights to selections

I’d like to build a feature where you could turn your highlighted matches to selections, maybe if you press the CTRL/Cmd key twice.

Is there any easy way to get highlighted range positions (line & ch for start and end points) of all matched selections? Then I can call setSelections when the shortcut is triggered with those ranges.

Assuming that I need to delve into modifying matchhighlighter.js - would you agree it’d be best to output range info from within the addOverlay function?

Overlays are stateless, and don’t really track their matches (in fact, they will only match at all in the visible viewport, during drawing). So you’ll have to manually find the matches in order to select them, maybe by using the search-cursor addon.

OK thanks for the info, much appreciated.