mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-18 01:39:55 +00:00
Try to get the sxnui font size to match the control, but this is w e i r d
This commit is contained in:
@@ -1104,4 +1104,13 @@ namespace winrt::TerminalApp::implementation
|
||||
_searchBox().Select(filter.size(), 0);
|
||||
}
|
||||
|
||||
double SuggestionsControl::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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,15 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<x:Double x:Key="ListFontSize">12</x:Double>
|
||||
<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" />
|
||||
FontSize="{ThemeResource ListFontSize}" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="GeneralItemTemplate"
|
||||
@@ -200,6 +200,7 @@
|
||||
CanReorderItems="False"
|
||||
ChoosingItemContainer="_choosingItemContainer"
|
||||
ContainerContentChanging="_containerContentChanging"
|
||||
FontSize="32"
|
||||
IsItemClickEnabled="True"
|
||||
ItemClick="_listItemClicked"
|
||||
ItemsSource="{x:Bind FilteredActions}"
|
||||
|
||||
@@ -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