Search should display the number of results it finds #8767

Closed
opened 2026-01-31 01:37:27 +00:00 by claunia · 12 comments
Owner

Originally created by @carlos-zamora on GitHub (Jun 2, 2020).

when the search term is not found, pressing enter on the find dialog announces nothing. It would be ideal if some message was announced to the effect that it was not found.

When it is found, NVDA reads the search term. I find that this behaviour is not that intuitive.

What does work well is that when escaping out of the find dialog, NVDA's review cursor is positioned at the starting position of the match for you to review around it.

Originally posted by @Neurrone in https://github.com/microsoft/terminal/issues/5421#issuecomment-632829133

Additional Details

With regards to accessibility, UIA should at least somehow notify the user that no results were found.

With regards to general UX, this kind of notification should be revealed in/near the search box. It would be cool if we could say something like "4 of 42 Results" and change it to "No Results" if none are found. But at the very least, somehow displaying "No Results" would be very useful.

Though we could just implement the accessibility approach, if we managed to implement the second approach instead, we would basically get accessibility for free.

(another approach) I think some apps would do some kind of noise when no result was found (though I think that's a bit of an older approach, correct me if I'm wrong). That would be another approach that would "bridge the gap" and solve this problem too.

Originally created by @carlos-zamora on GitHub (Jun 2, 2020). when the search term is not found, pressing enter on the find dialog announces nothing. It would be ideal if some message was announced to the effect that it was not found. When it is found, NVDA reads the search term. I find that this behaviour is not that intuitive. What does work well is that when escaping out of the find dialog, NVDA's review cursor is positioned at the starting position of the match for you to review around it. _Originally posted by @Neurrone in https://github.com/microsoft/terminal/issues/5421#issuecomment-632829133_ ## Additional Details With regards to accessibility, UIA should at least somehow notify the user that no results were found. With regards to general UX, this kind of notification should be revealed in/near the search box. It would be cool if we could say something like "4 of 42 Results" and change it to "No Results" if none are found. But at the very least, somehow displaying "No Results" would be very useful. Though we _could_ just implement the accessibility approach, if we managed to implement the second approach instead, we would basically get accessibility for free. (another approach) I think some apps would do some kind of noise when no result was found (though I think that's a bit of an older approach, correct me if I'm wrong). That would be another approach that would "bridge the gap" and solve this problem too.
Author
Owner

@Neurrone commented on GitHub (Jun 3, 2020):

(another approach) I think some apps would do some kind of noise when no result was found (though I think that's a bit of an older approach, correct me if I'm wrong).

Lets avoid that if possible. Some apps like notepad do that for example, but also pop up a dialog saying that nothing is found.

@Neurrone commented on GitHub (Jun 3, 2020): > (another approach) I think some apps would do some kind of noise when no result was found (though I think that's a bit of an older approach, correct me if I'm wrong). Lets avoid that if possible. Some apps like notepad do that for example, but also pop up a dialog saying that nothing is found.
Author
Owner

@Don-Vito commented on GitHub (Dec 14, 2020):

@DHowett, @carlos-zamora - I have a PoC for the number of results + interactive behavior (search upon every box modification).

I am not sure how severe are the performance implications on a very large buffer - to count the number of results I need to iterate all over all matches to count them (actually I also store them to prevent additional searches). If we are going to productize this, probably we can introduce some threshold on the size of buffer / number of matches beyond which we will show question marks, something like "2000 of ?".

SearchStatus

I lost several hours trying to implement live highlighting of all matches (with another color).. eventually I dieded.. (I guess changing renderer interface is still beyond my level).

  1. Please let me know - if you want this productized
  2. What do you believe is the correct approach to implement highlighting?
@Don-Vito commented on GitHub (Dec 14, 2020): @DHowett, @carlos-zamora - I have a PoC for the number of results + interactive behavior (search upon every box modification). I am not sure how severe are the performance implications on a very large buffer - to count the number of results I need to iterate all over all matches to count them (actually I also store them to prevent additional searches). If we are going to productize this, probably we can introduce some threshold on the size of buffer / number of matches beyond which we will show question marks, something like "2000 of ?". ![SearchStatus](https://user-images.githubusercontent.com/4639110/102137569-b4be8000-3e63-11eb-91cc-c92715324967.gif) I lost several hours trying to implement live highlighting of all matches (with another color).. eventually I dieded.. (I guess changing renderer interface is still beyond my level). 1. Please let me know - if you want this productized 2. What do you believe is the correct approach to implement highlighting?
Author
Owner

@DHowett commented on GitHub (Dec 14, 2020):

Let's not do highlighting just yet. There's some changes to the renderer we've been mulling over that might make it easier to implement down the road.

@DHowett commented on GitHub (Dec 14, 2020): Let's not do highlighting just yet. There's some changes to the renderer we've been mulling over that might make it easier to implement down the road.
Author
Owner

@DHowett commented on GitHub (Dec 14, 2020):

I'm totally fine with productizing the match counter, however. That's really neat.

@DHowett commented on GitHub (Dec 14, 2020): I'm totally fine with productizing the match counter, however. That's really neat.
Author
Owner

@Don-Vito commented on GitHub (Dec 14, 2020):

I'm totally fine with productizing the match counter, however. That's really neat.

What do you say about the feature flag - required or not?
I already introduced one in the draft, but it kinda doubles the code due to:

  • The setting propagation (I think we need to do something with the amount of boilerplate code required per setting)
  • Two absolutely independent implementations of search
@Don-Vito commented on GitHub (Dec 14, 2020): > > > I'm totally fine with productizing the match counter, however. That's really neat. What do you say about the feature flag - required or not? I already introduced one in the draft, but it kinda doubles the code due to: * The setting propagation (I think we need to do something with the amount of boilerplate code required per setting) * Two absolutely independent implementations of search
Author
Owner

@Don-Vito commented on GitHub (Dec 14, 2020):

@DHowett - I also need your insights on what should happen if the buffer changes amid iteration through the search results.

I mean, optimally, we need to re-compute the matches. However, this can be expensive to do on every update (and not that useful probably while text gets emitted).

The alternative is probably: do not update until the next interaction with the searchbox or replace with question marks until the interaction with the user.

Finally, what is the best approach for terminal control to know that the text has changed?

@Don-Vito commented on GitHub (Dec 14, 2020): @DHowett - I also need your insights on what should happen if the buffer changes amid iteration through the search results. I mean, optimally, we need to re-compute the matches. However, this can be expensive to do on every update (and not that useful probably while text gets emitted). The alternative is probably: do not update until the next interaction with the searchbox or replace with question marks until the interaction with the user. Finally, what is the best approach for terminal control to know that the text has changed?
Author
Owner

@Don-Vito commented on GitHub (Dec 15, 2020):

@DHowett - bump? 👼

@Don-Vito commented on GitHub (Dec 15, 2020): @DHowett - bump? 👼
Author
Owner

@Don-Vito commented on GitHub (Dec 15, 2020):

NVM. I will try to use onReceiveOutputFn + ThrottleFunc and hope it will be OK 😊

@Don-Vito commented on GitHub (Dec 15, 2020): NVM. I will try to use `onReceiveOutputFn` + `ThrottleFunc` and hope it will be OK :blush:
Author
Owner

@Don-Vito commented on GitHub (Dec 15, 2020):

I decided not to perform the search if the buffer changes, just update the number of matches and to replace the index of the match with "?" as appears here:

SearchStatusAutoUpdate

@Don-Vito commented on GitHub (Dec 15, 2020): I decided not to perform the search if the buffer changes, just update the number of matches and to replace the index of the match with "?" as appears here: ![SearchStatusAutoUpdate](https://user-images.githubusercontent.com/4639110/102281109-0126c000-3f37-11eb-956d-318ca5b93e81.gif)
Author
Owner

@DHowett commented on GitHub (Dec 15, 2020):

So, doing something throttled off of onReceiveOutputFn sounds good, but that is also our primary output path. We need it to be absolutely as performant as possible. We could take one additional branch there, I'd guess, but I wouldn't want that branch to invoke any WinRT things (like checking the visibility of the search box, or what-have-you). How best shall we strike the balance? This function is called CONSTANTLY 😄

Feature flag: nope, this is table stakes and should be present at all times. If a user doesn't want it, they can just not search.

@DHowett commented on GitHub (Dec 15, 2020): So, doing something throttled off of onReceiveOutputFn sounds good, but that is also our primary output path. We need it to be absolutely _as performant as possible_. We could take one additional branch there, I'd guess, but I wouldn't want that branch to invoke any WinRT things (like checking the visibility of the search box, or what-have-you). How best shall we strike the balance? This function is called **CONSTANTLY** :smile: Feature flag: nope, this is table stakes and should be present at all times. If a user doesn't want it, they can just not search.
Author
Owner

@Don-Vito commented on GitHub (Dec 16, 2020):

So, doing something throttled off of onReceiveOutputFn sounds good, but that is also our primary output path. We need it to be absolutely as performant as possible. We could take one additional branch there, I'd guess, but I wouldn't want that branch to invoke any WinRT things (like checking the visibility of the search box, or what-have-you). How best shall we strike the balance? This function is called CONSTANTLY 😄

Feature flag: nope, this is table stakes and should be present at all times. If a user doesn't want it, they can just not search.

Yeah.. good luck to me with the performance 😄 I believe there is much I will need to do about it.
Yet.. I will be happy if you could take a look after I merge the live updates and cleanup the feature flag, to review the overall direction (before I deep dive into optimizations).

@Don-Vito commented on GitHub (Dec 16, 2020): > > > So, doing something throttled off of onReceiveOutputFn sounds good, but that is also our primary output path. We need it to be absolutely _as performant as possible_. We could take one additional branch there, I'd guess, but I wouldn't want that branch to invoke any WinRT things (like checking the visibility of the search box, or what-have-you). How best shall we strike the balance? This function is called **CONSTANTLY** 😄 > > Feature flag: nope, this is table stakes and should be present at all times. If a user doesn't want it, they can just not search. Yeah.. good luck to me with the performance 😄 I believe there is much I will need to do about it. Yet.. I will be happy if you could take a look after I merge the live updates and cleanup the feature flag, to review the overall direction (before I deep dive into optimizations).
Author
Owner

@zadjii-msft commented on GitHub (Jan 31, 2022):

@Neurrone since you were the one who originally reported this, I wanted to give you the heads up: we've got a binary "results found" / "no results" announcement in #12301. We're gonna keep this one generally open for displaying the number of results in the search box, a la #8588. When that lands, we can refine the announcement to actually include the number of results.

@zadjii-msft commented on GitHub (Jan 31, 2022): @Neurrone since you were the one who originally reported this, I wanted to give you the heads up: we've got a binary "results found" / "no results" announcement in #12301. We're gonna keep this one generally open for displaying the number of results in the search box, a la #8588. When that lands, we can refine the announcement to actually include the number of results.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8767