Closed chrisgrieser closed 2 years ago
The new version I'm about to push actually treats a selection as a different highlighting mode. When a selection is active, the text inside the selection will be used as the regex. In this selection mode, there is no word boundary logic, it's a basic string search. This will allow for your sentence use case, as long as you select the full sentence. You could even select the entire paragraph, if you wanted. It won't work across line boundaries though.
Addressed in 0.0.5
nice idea. two suggestions for this one:
The selected string styling is also an indicator of whether or not there were any matches found. If your selection is underlined, that means a match was found. You good with not having that?
I assume you'd still want the data attribute containing the text of the selection?
Can you describe your use case for the string select ignore list setting?
The selected string styling is also an indicator of whether or not there were any matches found. If your selection is underlined, that means a match was found. You good with not having that?
Good point. However, a selection always getting additional styling, can also be quite a bit distracting though. not totally sure how to solve this one 🤔
I assume you'd still want the data attribute containing the text of the selection?
sure!
Can you describe your use case for the string select ignore list setting?
Well, by default, the selected-string-highlight should of course ignore the words in the ignore list. However, as opposed to simply having the cursor somewhere, the selection of text is more intentional action by the user. This means that maybe, the user actually does want to search for all occurrences of the word "the" in their text. a setting would allow this kind of flexibility.
(However, I think this is indeed a quite niche use case, so simply having the ignore list always apply would also be fine, I think.)
Addressed in 0.0.6
everything works great!
The plugin currently simply selects the first word. However, when I am selecting text, this probably means that I am doing something where highlights do not matter that much anyway, and the extra highlight only adds noise.
Alternatively, the plugin could select both/all words there a selection is, and highlight all occurrences of those two words occurring together, which might also be useful.