Command palette search results should bold the matching text #9222

Closed
opened 2026-01-31 01:49:00 +00:00 by claunia · 13 comments
Owner

Originally created by @zadjii-msft on GitHub (Jun 23, 2020).

Originally assigned to: @DHowett on GitHub.

Omitted from initial implementation in #6635.

I'm really unsure if this is possible in XAML, but hey, I think it would be important.

Originally created by @zadjii-msft on GitHub (Jun 23, 2020). Originally assigned to: @DHowett on GitHub. Omitted from initial implementation in #6635. I'm _really_ unsure if this is possible in XAML, but hey, I think it would be important.
Author
Owner

@DHowett commented on GitHub (Jun 23, 2020):

If we're using TextBlocks we can just fill them with Runs generated at runtime 😄

@DHowett commented on GitHub (Jun 23, 2020): If we're using TextBlocks we can just fill them with `Run`s generated at runtime :smile:
Author
Owner

@DHowett commented on GitHub (Jun 23, 2020):

image

<TextBlock FontFamily="Segoe UI" FontSize="32">
  <Run FontWeight="Bold">N</Run><Run>ew</Run> <Run FontWeight="Bold">T</Run><Run>ab</Run>
</TextBlock>
@DHowett commented on GitHub (Jun 23, 2020): ![image](https://user-images.githubusercontent.com/189190/85454422-c4fb3f80-b551-11ea-9eb9-a71dc5d84cab.png) ```xml <TextBlock FontFamily="Segoe UI" FontSize="32"> <Run FontWeight="Bold">N</Run><Run>ew</Run> <Run FontWeight="Bold">T</Run><Run>ab</Run> </TextBlock> ```
Author
Owner

@zadjii-msft commented on GitHub (Jun 23, 2020):

Yes, that's easy enough, but then we need to hook up a lot more XAML - the Palette knows which characters need to be highlighted, so it would need to set that on each of the commands in the match list, then each of those guys would need to return a Run instead of just a string.

It's not impossible, but it's a lot more XAML binding than anything I've done

@zadjii-msft commented on GitHub (Jun 23, 2020): Yes, that's easy enough, but then we need to hook up a lot more XAML - the Palette knows which characters need to be highlighted, so it would need to set that on each of the commands in the match list, then each of those guys would need to return a `Run` instead of just a `string`. It's not impossible, but it's a lot more XAML binding than anything I've done
Author
Owner

@DHowett commented on GitHub (Jun 25, 2020):

Mind if I bump this one into 2.0? If you don't get to it, I'd like to. 😄

@DHowett commented on GitHub (Jun 25, 2020): Mind if I bump this one into 2.0? If you don't get to it, I'd like to. :smile:
Author
Owner

@zadjii-msft commented on GitHub (Jun 25, 2020):

Sure thing, it's done

@zadjii-msft commented on GitHub (Jun 25, 2020): Sure thing, it's done
Author
Owner

@DHowett commented on GitHub (Jun 25, 2020):

Thanks!

@DHowett commented on GitHub (Jun 25, 2020): Thanks!
Author
Owner

@Don-Vito commented on GitHub (Oct 19, 2020):

@DHowett, @zadjii-msft - so this was planned to be a nice warmup exercise for Saturday morning. This was a bad decision 😄.. aka how to ruin a half of your weekend..

  • Defining a model that instead of a name stores a vector of matched and not matched segments - easy
  • Now let's bind it to the runs - the WinRT Textblock::Inlines are not bindable (ouch)
  • No problem, let's register an attached property and create runs in code behind - coded everything (even with nice converter), XAML complains on the binding. Reading WinRT docs (ouch 2):
    image
  • Ha, good luck defining imperatively dynamic context without tons of code-behind. No problem, I will simply create a custom control. WinRT TextBlock is sealed (ouch 3)
  • Found myself writing a User Control 😞

On a positive side, it work.. on a negative I need to do a lot of cleanups before this worth a PR
SearchHighlightNoMouse

@Don-Vito commented on GitHub (Oct 19, 2020): @DHowett, @zadjii-msft - so this was planned to be a nice warmup exercise for Saturday morning. This was a bad decision 😄.. aka how to ruin a half of your weekend.. * Defining a model that instead of a name stores a vector of matched and not matched segments - easy * Now let's bind it to the runs - the WinRT Textblock::Inlines are not bindable (ouch) * No problem, let's register an attached property and create runs in code behind - coded everything (even with nice converter), XAML complains on the binding. Reading WinRT docs (ouch 2): ![image](https://user-images.githubusercontent.com/4639110/96410228-3f318d00-11ef-11eb-9863-b0929eb5be8f.png) * Ha, good luck defining imperatively dynamic context without tons of code-behind. No problem, I will simply create a custom control. WinRT TextBlock is sealed (ouch 3) * Found myself writing a User Control 😞 On a positive side, it work.. on a negative I need to do a lot of cleanups before this worth a PR ![SearchHighlightNoMouse](https://user-images.githubusercontent.com/4639110/96410760-1362d700-11f0-11eb-9736-bdf36a91e115.gif)
Author
Owner

@DHowett commented on GitHub (Oct 19, 2020):

Hey! I worked on this for a bit too, actually, during a hackathon! I ended up binding the content of a Border to a property that produces a TextBlock itself with its own inline runs constructed at runtime.

I’ve been meaning to put it up for review, but I can hold off so we don’t have conflicting changes.

Thanks for working on this!

@DHowett commented on GitHub (Oct 19, 2020): Hey! I worked on this for a bit too, actually, during a hackathon! I ended up binding the content of a Border to a property that produces a TextBlock itself with its own inline runs constructed at runtime. I’ve been meaning to put it up for review, but I can hold off so we don’t have conflicting changes. Thanks for working on this!
Author
Owner

@Don-Vito commented on GitHub (Oct 19, 2020):

@DHowett - I kinda enjoyed 😄 . In any case please let me know if you believe it is something I should continue to productize - since if you have a working solution than probably we can skip mine.

BTW, I am not complaining and not regretting anything, but consider removing "help wanted" - I've seen some additional items, that were marked as "help wanted" but were at different stages of implementation.

@Don-Vito commented on GitHub (Oct 19, 2020): @DHowett - I kinda enjoyed 😄 . In any case please let me know if you believe it is something I should continue to productize - since if you have a working solution than probably we can skip mine. BTW, I am not complaining and not regretting anything, but consider removing "help wanted" - I've seen some additional items, that were marked as "help wanted" but were at different stages of implementation.
Author
Owner

@DHowett commented on GitHub (Oct 19, 2020):

That’s a very good call (about not keeping the help tag on things we start working on). I expect your solution is better than mine—after all, mine was little more than a hack—so I’d love to see you finish it. A label that can highlight specific ranges is a very useful general-purpose UserControl.

@DHowett commented on GitHub (Oct 19, 2020): That’s a very good call (about not keeping the help tag on things we start working on). I expect your solution is better than mine—after all, mine was little more than a hack—so I’d love to see you finish it. A label that can highlight specific ranges is a very useful general-purpose UserControl.
Author
Owner

@Don-Vito commented on GitHub (Oct 19, 2020):

@DHowett - from what I've learnt observing this community is that your "hacks" are much better than the best contribution I can do! 😄 In any case will continue to productize it during this week (it is in a bad shape, as I didn't work with neither C++, nor XAML in the last 8 years).

@Don-Vito commented on GitHub (Oct 19, 2020): @DHowett - from what I've learnt observing this community is that your "hacks" are much better than the best contribution I can do! :smile: In any case will continue to productize it during this week (it is in a bad shape, as I didn't work with neither C++, nor XAML in the last 8 years).
Author
Owner

@zadjii-msft commented on GitHub (Oct 19, 2020):

@Don-Vito I love it! Looking forward to the PR ☺️

@zadjii-msft commented on GitHub (Oct 19, 2020): @Don-Vito I love it! Looking forward to the PR ☺️
Author
Owner

@ghost commented on GitHub (Nov 11, 2020):

:tada:This issue was addressed in #7977, which has now been successfully released as Windows Terminal Preview v1.5.3142.0.🎉

Handy links:

@ghost commented on GitHub (Nov 11, 2020): :tada:This issue was addressed in #7977, which has now been successfully released as `Windows Terminal Preview v1.5.3142.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.5.3142.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9222