terminal/src/cascadia/TerminalApp/HighlightedText.h
Don-Vito 1aff3bc216
Bold matching text in the command palette (#7977)
* Created a ViewModel class in the Command Palette called
  FilteredCommand, aggregating the Command, the filter and the
  highlighted presentation of the command name
* This ListView of the filtered commands is bound to the vector of
  FilteredCommands
* Introduced HighlightedTextControl user control with HighlightedText
  view model
* Added this control to the ListView Item's grid
* Bound the FilteredCommand's highlighted command name to the user
  control

## Validation Steps Performed
* UT for matching algorithm
* Only manual tests
* Searching in CommandLine, SwitchTab and Nested Command modes
* Checking for bot matching an non matching filters
* Dogfooding

Closes #6646
2020-11-05 17:37:45 -08:00

39 lines
1.4 KiB
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#pragma once
#include "winrt/Microsoft.UI.Xaml.Controls.h"
#include "HighlightedTextSegment.g.h"
#include "HighlightedText.g.h"
#include "../../cascadia/inc/cppwinrt_utils.h"
namespace winrt::TerminalApp::implementation
{
struct HighlightedTextSegment : HighlightedTextSegmentT<HighlightedTextSegment>
{
HighlightedTextSegment() = default;
HighlightedTextSegment(winrt::hstring const& text, bool isHighlighted);
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
OBSERVABLE_GETSET_PROPERTY(winrt::hstring, TextSegment, _PropertyChangedHandlers);
OBSERVABLE_GETSET_PROPERTY(bool, IsHighlighted, _PropertyChangedHandlers);
};
struct HighlightedText : HighlightedTextT<HighlightedText>
{
HighlightedText() = default;
HighlightedText(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment> const& segments);
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
OBSERVABLE_GETSET_PROPERTY(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>, Segments, _PropertyChangedHandlers);
};
}
namespace winrt::TerminalApp::factory_implementation
{
BASIC_FACTORY(HighlightedTextSegment);
BASIC_FACTORY(HighlightedText);
}