Merge remote-tracking branch 'origin/main' into feature/llm

# Conflicts:
#	src/cascadia/TerminalApp/TerminalPage.cpp
#	src/cascadia/TerminalSettingsEditor/MainPage.cpp
This commit is contained in:
Dustin L. Howett
2026-01-09 13:30:04 -06:00
19 changed files with 175 additions and 47 deletions

View File

@@ -0,0 +1,8 @@
# Same as the official arm64-windows-static triplet
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# ...but with explicit platform toolset, so that future toolsets
# aren't automatically picked up (it defaults to the latest one).
set(VCPKG_PLATFORM_TOOLSET v143)

View File

@@ -1,6 +1,11 @@
# Same as the official arm64-windows-static triplet
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# ...but with explicit platform toolset, so that future toolsets
# aren't automatically picked up (it defaults to the latest one).
set(VCPKG_PLATFORM_TOOLSET v143)
set(VCPKG_CXX_FLAGS /fsanitize=address)
set(VCPKG_C_FLAGS /fsanitize=address)

View File

@@ -1,6 +1,11 @@
# Same as the official x64-windows-static triplet
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# ...but with explicit platform toolset, so that future toolsets
# aren't automatically picked up (it defaults to the latest one).
set(VCPKG_PLATFORM_TOOLSET v143)
set(VCPKG_CXX_FLAGS /fsanitize=address)
set(VCPKG_C_FLAGS /fsanitize=address)

View File

@@ -1,6 +1,11 @@
# Same as the official x86-windows-static triplet
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# ...but with explicit platform toolset, so that future toolsets
# aren't automatically picked up (it defaults to the latest one).
set(VCPKG_PLATFORM_TOOLSET v143)
set(VCPKG_CXX_FLAGS /fsanitize=address)
set(VCPKG_C_FLAGS /fsanitize=address)

View File

@@ -0,0 +1,8 @@
# Same as the official x64-windows-static triplet
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# ...but with explicit platform toolset, so that future toolsets
# aren't automatically picked up (it defaults to the latest one).
set(VCPKG_PLATFORM_TOOLSET v143)

View File

@@ -0,0 +1,8 @@
# Same as the official x86-windows-static triplet
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# ...but with explicit platform toolset, so that future toolsets
# aren't automatically picked up (it defaults to the latest one).
set(VCPKG_PLATFORM_TOOLSET v143)

View File

@@ -7,8 +7,9 @@
#include <TerminalCore/ControlKeyStates.hpp>
#include <TerminalThemeHelpers.h>
#include <til/hash.h>
#include <til/io.h>
#include <til/hash.h>
#include <til/unicode.h>
#include <shlobj.h>
#include <Utils.h>
@@ -3198,7 +3199,19 @@ namespace winrt::TerminalApp::implementation
{
// We have to initialize the dialog here to be able to change the text of the text block within it
std::ignore = FindName(L"MultiLinePasteDialog");
ClipboardText().Text(text);
// WinUI absolutely cannot deal with large amounts of text (at least O(n), possibly O(n^2),
// so we limit the string length here and add an ellipsis if necessary.
auto clipboardText = text;
if (clipboardText.size() > 1024)
{
const std::wstring_view view{ text };
// Make sure we don't cut in the middle of a surrogate pair
const auto len = til::utf16_iterate_prev(view, 512);
clipboardText = til::hstring_format(FMT_COMPILE(L"{}\n"), view.substr(0, len));
}
ClipboardText().Text(std::move(clipboardText));
// The vertical offset on the scrollbar does not reset automatically, so reset it manually
ClipboardContentScrollViewer().ScrollToVerticalOffset(0);
@@ -3214,7 +3227,7 @@ namespace winrt::TerminalApp::implementation
}
// Clear the clipboard text so it doesn't lie around in memory
ClipboardText().Text(L"");
ClipboardText().Text({});
if (warningResult != ContentDialogResult::Primary)
{

View File

@@ -202,6 +202,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return _isFontFeature;
}
winrt::hstring FontKeyValuePair::AutomationName()
{
return hstring{ fmt::format(FMT_COMPILE(L"{}: {}"), KeyDisplayStringRef(), _value) };
}
AppearanceViewModel::AppearanceViewModel(const Model::AppearanceConfig& appearance) :
_appearance{ appearance }
{

View File

@@ -47,6 +47,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
uint32_t Key() const noexcept;
float Value() const noexcept;
void Value(float v);
winrt::hstring AutomationName();
void SetValueDirect(float v);
bool IsFontFeature() const noexcept;

View File

@@ -28,6 +28,7 @@ namespace Microsoft.Terminal.Settings.Editor
UInt32 Key { get; };
String KeyDisplayString { get; };
Single Value;
String AutomationName { get; };
}
runtimeclass AppearanceViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged

View File

@@ -41,7 +41,8 @@
<DataTemplate x:Key="FontKeyValuePairTemplate"
x:DataType="local:FontKeyValuePair">
<Grid ColumnSpacing="8">
<Grid AutomationProperties.Name="{x:Bind AutomationName}"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
@@ -51,8 +52,10 @@
VerticalAlignment="Center"
Text="{x:Bind KeyDisplayString}" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind KeyDisplayString}"
Value="{x:Bind Value, Mode=TwoWay}" />
<Button Grid.Column="2"
<Button x:Uid="Profile_DeleteFontKeyValuePairButton"
Grid.Column="2"
Click="DeleteFontKeyValuePair_Click"
Style="{StaticResource DeleteButtonStyle}"
Tag="{x:Bind (local:FontKeyValuePair)}">
@@ -197,7 +200,8 @@
FontFamily="Cascadia Code"
Foreground="{x:Bind mtu:Converters.ColorToBrush(ForegroundColor.Color), Mode=OneWay}"
Text="{x:Bind Name, Mode=OneWay}"
TextTrimming="WordEllipsis" />
TextTrimming="WordEllipsis"
ToolTipService.ToolTip="{x:Bind Name, Mode=OneWay}" />
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>

View File

@@ -170,6 +170,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Automation::AutomationProperties::SetHelpText(OpenJsonNavItem(), RS_(L"Nav_OpenJSON/[using:Windows.UI.Xaml.Controls]ToolTipService/ToolTip"));
// GH#19688: the nav item text may be truncated, so we need to set tooltips for all nav items. Reuse the displayed text resources.
WUX::Controls::ToolTipService::SetToolTip(LaunchNavItem(), box_value(RS_(L"Nav_Launch/Content")));
WUX::Controls::ToolTipService::SetToolTip(InteractionNavItem(), box_value(RS_(L"Nav_Interaction/Content")));
WUX::Controls::ToolTipService::SetToolTip(AppearanceNavItem(), box_value(RS_(L"Nav_Appearance/Content")));
WUX::Controls::ToolTipService::SetToolTip(ColorSchemesNavItem(), box_value(RS_(L"Nav_ColorSchemes/Content")));
WUX::Controls::ToolTipService::SetToolTip(RenderingNavItem(), box_value(RS_(L"Nav_Rendering/Content")));
WUX::Controls::ToolTipService::SetToolTip(CompatibilityNavItem(), box_value(RS_(L"Nav_Compatibility/Content")));
WUX::Controls::ToolTipService::SetToolTip(ActionsNavItem(), box_value(RS_(L"Nav_Actions/Content")));
WUX::Controls::ToolTipService::SetToolTip(NewTabMenuNavItem(), box_value(RS_(L"Nav_NewTabMenu/Content")));
WUX::Controls::ToolTipService::SetToolTip(ExtensionsNavItem(), box_value(RS_(L"Nav_Extensions/Content")));
WUX::Controls::ToolTipService::SetToolTip(BaseLayerMenuItem(), box_value(RS_(L"Nav_ProfileDefaults/Content")));
WUX::Controls::ToolTipService::SetToolTip(OpenJsonNavItem(), box_value(RS_(L"Nav_OpenJSON/Content")));
WUX::Controls::ToolTipService::SetToolTip(AISettingsNavItem(), box_value(RS_(L"Nav_AISettings/Content")));
_breadcrumbs = single_threaded_observable_vector<IInspectable>();
@@ -821,8 +832,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// Top off (the end of the nav view) with the Add Profile item
MUX::Controls::NavigationViewItem addProfileItem;
addProfileItem.Content(box_value(RS_(L"Nav_AddNewProfile/Content")));
const auto addProfileText = RS_(L"Nav_AddNewProfile/Content");
addProfileItem.Content(box_value(addProfileText));
addProfileItem.Tag(box_value(addProfileTag));
WUX::Controls::ToolTipService::SetToolTip(addProfileItem, box_value(addProfileText));
FontIcon icon;
// This is the "Add" symbol
@@ -899,6 +912,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
profileNavItem.Content(box_value(profile.Name()));
profileNavItem.Tag(box_value<Editor::ProfileViewModel>(profile));
profileNavItem.Icon(UI::IconPathConverter::IconWUX(profile.EvaluatedIcon()));
WUX::Controls::ToolTipService::SetToolTip(profileNavItem, box_value(profile.Name()));
if (profile.Orphaned())
{
@@ -922,6 +936,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
else if (args.PropertyName() == L"Name")
{
menuItem.Content(box_value(tag.Name()));
WUX::Controls::ToolTipService::SetToolTip(menuItem, box_value(tag.Name()));
}
else if (args.PropertyName() == L"Hidden")
{

View File

@@ -101,21 +101,24 @@
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem x:Uid="Nav_Launch"
<muxc:NavigationViewItem x:Name="LaunchNavItem"
x:Uid="Nav_Launch"
Tag="Launch_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7B5;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Interaction"
<muxc:NavigationViewItem x:Name="InteractionNavItem"
x:Uid="Nav_Interaction"
Tag="Interaction_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7C9;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Appearance"
<muxc:NavigationViewItem x:Name="AppearanceNavItem"
x:Uid="Nav_Appearance"
Tag="GlobalAppearance_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE771;" />
@@ -130,21 +133,24 @@
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Rendering"
<muxc:NavigationViewItem x:Name="RenderingNavItem"
x:Uid="Nav_Rendering"
Tag="Rendering_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7F8;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Compatibility"
<muxc:NavigationViewItem x:Name="CompatibilityNavItem"
x:Uid="Nav_Compatibility"
Tag="Compatibility_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEC7A;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Actions"
<muxc:NavigationViewItem x:Name="ActionsNavItem"
x:Uid="Nav_Actions"
Tag="Actions_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE765;" />
@@ -155,14 +161,16 @@
</muxc:NavigationViewItem.InfoBadge>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_NewTabMenu"
<muxc:NavigationViewItem x:Name="NewTabMenuNavItem"
x:Uid="Nav_NewTabMenu"
Tag="NewTabMenu_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE71d;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Extensions"
<muxc:NavigationViewItem x:Name="ExtensionsNavItem"
x:Uid="Nav_Extensions"
Tag="Extensions_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEA86;" />

View File

@@ -998,6 +998,9 @@
<data name="Profile_AddFontFeatureButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Add new font feature</value>
</data>
<data name="Profile_DeleteFontKeyValuePairButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Delete</value>
</data>
<data name="Profile_AddNewFontFeature.Text" xml:space="preserve">
<value>Add new</value>
<comment>Button label that adds a new font feature for the current font.</comment>

View File

@@ -65,37 +65,6 @@ namespace std
};
}
template<>
struct fmt::formatter<winrt::hstring, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t>
{
auto format(const winrt::hstring& str, auto& ctx) const
{
return fmt::formatter<fmt::wstring_view, wchar_t>::format({ str.data(), str.size() }, ctx);
}
};
template<>
struct fmt::formatter<winrt::guid, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t>
{
auto format(const winrt::guid& value, auto& ctx) const
{
return fmt::format_to(
ctx.out(),
L"{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}",
value.Data1,
value.Data2,
value.Data3,
value.Data4[0],
value.Data4[1],
value.Data4[2],
value.Data4[3],
value.Data4[4],
value.Data4[5],
value.Data4[6],
value.Data4[7]);
}
};
// This is a helper macro for both declaring the signature of an event, and
// defining the body. Winrt events need a method for adding a callback to the
// event and removing the callback. This macro will both declare the method

View File

@@ -119,4 +119,47 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned"
return lhs == rhs;
}
};
// fmt::format but for HSTRING.
template<typename... Args>
winrt::hstring hstring_format(Args&&... args)
{
// We could use fmt::formatted_size and winrt::impl::hstring_builder here,
// and this would make formatting of large strings a bit faster, and a bit slower
// for short strings. More importantly, I hit compilation issues so I dropped that.
fmt::basic_memory_buffer<wchar_t> buf;
fmt::format_to(std::back_inserter(buf), args...);
return winrt::hstring{ buf.data(), gsl::narrow<uint32_t>(buf.size()) };
}
}
template<>
struct fmt::formatter<winrt::hstring, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t>
{
auto format(const winrt::hstring& str, auto& ctx) const
{
return fmt::formatter<fmt::wstring_view, wchar_t>::format({ str.data(), str.size() }, ctx);
}
};
template<>
struct fmt::formatter<winrt::guid, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t>
{
auto format(const winrt::guid& value, auto& ctx) const
{
return fmt::format_to(
ctx.out(),
L"{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}",
value.Data1,
value.Data2,
value.Data3,
value.Data4[0],
value.Data4[1],
value.Data4[2],
value.Data4[3],
value.Data4[4],
value.Data4[5],
value.Data4[6],
value.Data4[7]);
}
};

View File

@@ -45,10 +45,13 @@
<ClInclude Include="..\..\inc\til\bytes.h" />
<ClInclude Include="..\..\inc\til\coalesce.h" />
<ClInclude Include="..\..\inc\til\color.h" />
<ClInclude Include="..\..\inc\til\colorbrewer.h" />
<ClInclude Include="..\..\inc\til\enumset.h" />
<ClInclude Include="..\..\inc\til\env.h" />
<ClInclude Include="..\..\inc\til\flat_set.h" />
<ClInclude Include="..\..\inc\til\generational.h" />
<ClInclude Include="..\..\inc\til\hash.h" />
<ClInclude Include="..\..\inc\til\io.h" />
<ClInclude Include="..\..\inc\til\latch.h" />
<ClInclude Include="..\..\inc\til\math.h" />
<ClInclude Include="..\..\inc\til\mutex.h" />
@@ -57,6 +60,7 @@
<ClInclude Include="..\..\inc\til\point.h" />
<ClInclude Include="..\..\inc\til\rand.h" />
<ClInclude Include="..\..\inc\til\rect.h" />
<ClInclude Include="..\..\inc\til\regex.h" />
<ClInclude Include="..\..\inc\til\replace.h" />
<ClInclude Include="..\..\inc\til\rle.h" />
<ClInclude Include="..\..\inc\til\size.h" />
@@ -69,6 +73,7 @@
<ClInclude Include="..\..\inc\til\type_traits.h" />
<ClInclude Include="..\..\inc\til\u8u16convert.h" />
<ClInclude Include="..\..\inc\til\unicode.h" />
<ClInclude Include="..\..\inc\til\winrt.h" />
<ClInclude Include="..\precomp.h" />
</ItemGroup>
<ItemDefinitionGroup>

View File

@@ -2,6 +2,8 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Natvis Include="$(SolutionDir)tools\ConsoleTypes.natvis" />
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natstepfilter" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\precomp.cpp" />
@@ -121,6 +123,21 @@
<ClInclude Include="..\..\inc\til\type_traits.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="..\..\inc\til\colorbrewer.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="..\..\inc\til\flat_set.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="..\..\inc\til\io.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="..\..\inc\til\regex.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="..\..\inc\til\winrt.h">
<Filter>inc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="inc">

View File

@@ -38,6 +38,11 @@
],
"builtin-baseline": "fe1cde61e971d53c9687cf9a46308f8f55da19fa",
"vcpkg-configuration": {
"overlay-ports": [ "./dep/vcpkg-overlay-ports" ]
"overlay-triplets": [
"./dep/vcpkg-overlay-triplets"
],
"overlay-ports": [
"./dep/vcpkg-overlay-ports"
]
}
}