Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find/Replace Overlay: highlight regex matches toggle #2679

Open
Tracked by #2021
nlisker opened this issue Jan 9, 2025 · 3 comments
Open
Tracked by #2021

Find/Replace Overlay: highlight regex matches toggle #2679

nlisker opened this issue Jan 9, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@nlisker
Copy link

nlisker commented Jan 9, 2025

When writing a regex in the Find field, it's useful to see the matches in the selected region (or the whole file if no region is selected) in real-time, much like ctrl+F works in browsers. This avoids repeatedly clicking on Find to see if the regex works as intended. Because for large files this can be costly, it should be enabled via a toggle. Matched regions can be indicated with a background highlight, just like Toggle Mark Occurrences works.

This is also relevant for the "old" Find/Replace dialog.

@nlisker nlisker added the enhancement New feature or request label Jan 9, 2025
@HeikoKlare
Copy link
Contributor

I agree that this would be quite helpful to test regular expressions.

The proposal has some overlap with:

That one proposes to mark occurrences of a search string inside the document while typing. When this is also applied to regex searches (as it should be by default) and if it is also limited to the selected region (in case such a region is defined), it should cover this proposal completely, if I understand it correctly.

Note that we merged a PR last week, which also partly covers this proposal:

Search-as-you-type is now also applied in regex mode, so you can already use this to test a regex, but it will only give you a single match and not all matches in the selected region. But is of course also restricted to the selected region.

@jukzi
Copy link
Contributor

jukzi commented Jan 10, 2025

+1

@nlisker
Copy link
Author

nlisker commented Jan 10, 2025

@HeikoKlare I updated to the latest build and I can see the change, it's certainly better. Apart from finding only the first search result, I found it odd that the highlight is actually a selection, so if I leave the Find/Replace focus my typing replaces the selection. I would have thought a "passive" highlight like Mark Occurrences would be more apt. Is there a reason to use selection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants