-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement active/inactive highlight during a Search #564
Comments
Behavior notesSome notes for myself about how other apps behave during search, specifically about when they remove the highlights and end the "search" mode. We'll have to choose when to end it and hopefully not have to pepper "turn this off" code all over the place. All of the below are from Mac but some will be cross-platform behavior, particularly the browsers. Note, many of these say BrowsersSafari
Google Chrome
Firefox
Microsoft Edge
EditorsFor editors, I'll look at "search within this file" and ignore their "search entire project" modes. Visual Studio Code
TextEdit
BBEdit
Sublime Text
TextMate
Microsoft Word
Neovim
ReadersPreview
Apple BooksDoesn't support this mode Kindle appDoesn't support this mode |
The obvious times to cancel this mode:
Possible others, up for debate:
But probably also should clean up before various tools are run, e.g. we would want this out of the way before doing footnote fixup or other tools. Do we need a general "do some cleanup" routine for such tools to run before starting? What I don't want is to have to litter a function specifically for this all over the place. |
Of the categories I surveyed, GG falls best into Text Editor. And for those, most leave the highlights in place if you click into the file, select or work with text, etc. And they only remove it when you stop the find mode. Maybe we leave these tags in place until the Search dialog is closed (or Remove All Highlights is run)? I would still be concerned they would be "in the way" for fixups and so on but maybe I'm overthinking it. They are just style tags, they wouldn't affect how those tools work and could be place below spotlight in the tag hierarchy (I think they already are) so such tools would override anyway. |
Thanks for gathering and reporting that info, Dan. Useful to see what is common, and also that there is quite a range of behavior. Notepad++
As you commented, for a text editor it seems best to leave the highlights in place if you click into the file. Occasionally I find the tags left behind by VScode annoying, but as a first pass, I'd be happy with saying the tags stay there until you close the Search dialog, or edit the Search string (there's a validator routine that gets called to check for bad regexes that could remove the tags), or start a brand new search, or use Remove All Highlights. We could leave it until later to see whether we receive feedback about it being too busy. If so, then we could clear tags whenever a CheckerDialog is created (which is pretty much all the main tools except WF). Or possibly make it a setting in the Prefs dialog ("Highlight search matches") for those who really don't like it. It could be a setting in the Search dialog, but I think that dialog is busy enough already. |
For me, it brings up the context menu, and only removes the highlights as a side-effect.
It may be an effect of the particular theme I have in BBEdit, but as long as the selection is active (i.e. until it's canceled), BBEdit shows the search results in a very obvious highlight color while the search window is active, or a pale (in comparison to the background color) highlight if the text window is active. As well as an underline (maybe for accessibility?). It also shows relative position of the search results in the file with a horizontal line in the scrollbar. Like the other highlighting, this is canceled when the user clicks inside the text window. |
When searching, jump between matches as before when navigating matches, but also highlight all other matches for user convenience. Highlights removed when: - search is changed to a new search string - "Remove Highlights" command is run - Search dialog is closed Fixes DistributedProofreaders#564
When searching, jump between matches as before when navigating matches, but also highlight all other matches for user convenience. Highlights removed when: - search is changed to a new search string - "Remove Highlights" command is run - Search dialog is closed Fixes DistributedProofreaders#564
When searching, jump between matches as before when navigating matches, but also highlight all other matches for user convenience. Highlights removed when: - search is changed to a new search string - "Remove Highlights" command is run - Search dialog is closed Fixes DistributedProofreaders#564
When searching, jump between matches as before when navigating matches, but also highlight all other matches for user convenience. Highlights removed when: - search is changed to a new search string - "Remove Highlights" command is run - Search dialog is closed Fixes DistributedProofreaders#564
As discussed in #561.
Currently when you search (and use next/prev...) the currently focused match is highlighted as you navigate from one match to the next. Other matches, even if they are within the viewport, are treated as normal text and not highlighted.
Leave the currently focused match as-is. Implement a noticeable but de-emphasized highlight on other matches which fall into the viewport. Matches outside the viewport should probably not be considered, to avoid searching the entire file repeatedly. Implement something to run in on_change to reconsider / rehighlight the viewport rather than try to highlight the entire file, which can be too slow.
The text was updated successfully, but these errors were encountered: