mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-18 10:50:44 +00:00
Compare commits
3 Commits
dev/duhowe
...
dev/migrie
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63b1599406 | ||
|
|
75ee4559a3 | ||
|
|
6c0508611f |
@@ -996,6 +996,22 @@ namespace winrt::TerminalApp::implementation
|
||||
args.ItemContainer(listViewItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Incredibly bodgy:
|
||||
//
|
||||
// Now that we've found the right ListViewItem, set the font size on it,
|
||||
// to match the size of the control. This might change over the life of
|
||||
// the window.
|
||||
// * we can't use a Style in the resources to set this (it only gets evaluated once)
|
||||
// * we can't bind from the DataTemplate to the parent UserControl's properties
|
||||
//
|
||||
// But this method (_choosingItemContainer) is called on each and every
|
||||
// ListViewItem every time we're opened.
|
||||
if (const auto item{ args.ItemContainer().try_as<ListViewItem>() })
|
||||
{
|
||||
item.FontSize(_FontHeight);
|
||||
}
|
||||
|
||||
args.IsContainerPrepared(true);
|
||||
}
|
||||
// Method Description:
|
||||
@@ -1104,4 +1120,19 @@ namespace winrt::TerminalApp::implementation
|
||||
_searchBox().Select(filter.size(), 0);
|
||||
}
|
||||
|
||||
// double SuggestionsControl::FontHeight()
|
||||
// {
|
||||
// return _fontHeight;
|
||||
// // return winrt::unbox_value_or<double>(Resources().Lookup(winrt::box_value(L"ListFontSize")), 12.0);
|
||||
// }
|
||||
// void SuggestionsControl::FontHeight(double height)
|
||||
// {
|
||||
// // Resources().Insert(winrt::box_value(L"ListFontSize"), winrt::box_value(height));
|
||||
// for (const auto& container : _filteredActionsView().Items())
|
||||
// {
|
||||
// auto item{container.try_as<winrt::Windows::UI::Xaml::Controls::ListViewItem>()};
|
||||
// item.FontSize(height);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -50,12 +50,16 @@ namespace winrt::TerminalApp::implementation
|
||||
til::typed_event<winrt::TerminalApp::SuggestionsControl, Microsoft::Terminal::Settings::Model::Command> DispatchCommandRequested;
|
||||
til::typed_event<Windows::Foundation::IInspectable, Microsoft::Terminal::Settings::Model::Command> PreviewAction;
|
||||
|
||||
// double FontHeight();
|
||||
// void FontHeight(double height);
|
||||
|
||||
til::property_changed_event PropertyChanged;
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, NoMatchesText, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, SearchBoxPlaceholderText, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ControlName, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ParentCommandName, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ParsedCommandLineText, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(double, FontHeight, PropertyChanged.raise, 12.0);
|
||||
|
||||
private:
|
||||
struct winrt_object_hash
|
||||
@@ -86,6 +90,7 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::TerminalApp::PaletteItemTemplateSelector _itemTemplateSelector{ nullptr };
|
||||
std::unordered_map<Windows::UI::Xaml::DataTemplate, std::unordered_set<Windows::UI::Xaml::Controls::Primitives::SelectorItem, winrt_object_hash>, winrt_object_hash> _listViewItemsCache;
|
||||
Windows::UI::Xaml::DataTemplate _listItemTemplate;
|
||||
double _fontHeight{ 12.0 };
|
||||
|
||||
void _switchToMode();
|
||||
void _setDirection(TerminalApp::SuggestionsDirection direction);
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace TerminalApp
|
||||
String SearchBoxPlaceholderText { get; };
|
||||
String ControlName { get; };
|
||||
String ParentCommandName { get; };
|
||||
Double FontHeight{ get; set; };
|
||||
|
||||
Windows.UI.Xaml.FrameworkElement SelectedItem { get; };
|
||||
|
||||
|
||||
@@ -25,15 +25,16 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<!-- <Style TargetType="ListViewItem" x:Key="Foo">
|
||||
<Setter Property="FontSize" Value="{x:Bind FontHeight, Mode=OneWay}" />
|
||||
</Style>-->
|
||||
<DataTemplate x:Key="ListItemTemplate"
|
||||
x:DataType="local:FilteredCommand">
|
||||
<ListViewItem Height="32"
|
||||
MinHeight="0"
|
||||
Padding="16,0,12,0"
|
||||
<ListViewItem MinHeight="0"
|
||||
Padding="16,6,12,6"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
AutomationProperties.AcceleratorKey="{x:Bind Item.KeyChordText, Mode=OneWay}"
|
||||
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
|
||||
FontSize="12" />
|
||||
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="GeneralItemTemplate"
|
||||
|
||||
@@ -4764,6 +4764,8 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto realCursorPos{ controlTransform.TransformPoint({ cursorPos.X, cursorPos.Y }) }; // == controlTransform + cursorPos
|
||||
const Windows::Foundation::Size windowDimensions{ gsl::narrow_cast<float>(ActualWidth()), gsl::narrow_cast<float>(ActualHeight()) };
|
||||
|
||||
sxnUi.FontHeight(characterSize.Height);
|
||||
|
||||
sxnUi.Open(mode,
|
||||
commandsCollection,
|
||||
filterText,
|
||||
|
||||
Reference in New Issue
Block a user