Sublime Forum

What is the Find Results highlight key?

#1

Hi,

When I want to highlight, I use :

view.add_regions("my_key", regions, "region.redish", "circle", sublime.DRAW_NO_FILL)

If I want to get regions associated to my_key, I use :
view.get_regions("my_key")

My question is : On « Find Results » views (generated by Sublime Text), how to get the regions of the highlighted matches ?

Asked differently : What is the highlight key used by Find Results ?

The solution I came up (which does not satisfy me), is to actually re-do the search on the Find Results content, which give me the highlighted positions (at matches positions).

What I really want, is to know if we can use view.get_regions("secret_find_results_highlight_key") to get all highlighted matches on a Find Results view, and if YES : What is the highlight_key.

Thanks a lot :grin:

0 Likes

#2

The key is "match". Note that it’s “secret” for a reason in that we don’t make any guarantees towards backwards compatibility.

4 Likes

#3

Thank you very much!! :pray: :partying_face:

Is there also a “secret” key for Ctrl+F highlights?

(normal search, not Find Results view)

0 Likes

#4

"find" and "find_area" (for find in selection). Just going to reiterate my previous warning that these can and will break with updates.

4 Likes

#5

Fantastic!! :pray: :dizzy: :grin:

Is there also a “secret” key for same-selected-word highlight ?

(sublime-setting called “match_selection” <-> Highlights other occurrences of the currently selected text)

screenshot

0 Likes

#6

There isn’t, that’s being handled specially at render time.

2 Likes

#7

It was very instructive. Thanks again for your answers, and for all your continued contribution to Sublime Text and the community!!
:star2: :medal_military: :medal_sports:

0 Likes