Upgrade fmt to 11.0.2 (#16007)

Between fmt 7.1.3 and 11.0.2 a lot has happened. `wchar_t` support is
now more limited and implicit conversions don't work anymore.

Furthermore, even the non-`FMT_COMPILE` API is now compile-time checked
and so it fails to work in our UI code which passes `hstring` format
strings which aren't implicitly convertible to the expected type.
`fmt::runtime` was introduced for this but it also fails to work for
`hstring` parameters. To solve this, a new `RS_fmt` macro was added
to abstract the added `std::wstring_view` casting away.

Finally, some additional changes to reduce `stringstream` usage
have been made, whenever `format_to`, etc., is available.
This mostly affects `ActionArgs.cpp`.

Closes #16000

## Validation Steps Performed
* Compiles 
* Settings page opens 
This commit is contained in:
Leonard Hecker 2024-08-09 00:40:05 +02:00 committed by GitHub
parent ac865e6666
commit 9ab2870bc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 275 additions and 335 deletions

View File

@ -143,8 +143,8 @@ BTNFACE
bufferout bufferout
buffersize buffersize
buflen buflen
buildtransitive
buildsystems buildsystems
buildtransitive
BValue BValue
bytebuffer bytebuffer
cac cac
@ -2141,6 +2141,7 @@ XBUTTONDOWN
XBUTTONUP XBUTTONUP
XCast XCast
XCENTER XCENTER
xchar
xcopy xcopy
XCount XCount
xdy xdy

View File

@ -910,10 +910,8 @@ namespace winrt::TerminalApp::implementation
// Build the commandline to pass to wt for this set of NewTerminalArgs // Build the commandline to pass to wt for this set of NewTerminalArgs
// `-w -1` will ensure a new window is created. // `-w -1` will ensure a new window is created.
winrt::hstring cmdline{ const auto commandline = terminalArgs.ToCommandline();
fmt::format(L"-w -1 new-tab {}", winrt::hstring cmdline{ fmt::format(FMT_COMPILE(L"-w -1 new-tab {}"), commandline) };
terminalArgs.ToCommandline().c_str())
};
// Build the args to ShellExecuteEx. We need to use ShellExecuteEx so we // Build the args to ShellExecuteEx. We need to use ShellExecuteEx so we
// can pass the SEE_MASK_NOASYNC flag. That flag allows us to safely // can pass the SEE_MASK_NOASYNC flag. That flag allows us to safely
@ -1107,14 +1105,14 @@ namespace winrt::TerminalApp::implementation
{ {
if (const auto& realArgs = args.ActionArgs().try_as<SearchForTextArgs>()) if (const auto& realArgs = args.ActionArgs().try_as<SearchForTextArgs>())
{ {
queryUrl = realArgs.QueryUrl().c_str(); queryUrl = std::wstring_view{ realArgs.QueryUrl() };
} }
} }
// use global default if query URL is unspecified // use global default if query URL is unspecified
if (queryUrl.empty()) if (queryUrl.empty())
{ {
queryUrl = _settings.GlobalSettings().SearchWebDefaultQueryUrl().c_str(); queryUrl = std::wstring_view{ _settings.GlobalSettings().SearchWebDefaultQueryUrl() };
} }
constexpr std::wstring_view queryToken{ L"%s" }; constexpr std::wstring_view queryToken{ L"%s" };

View File

@ -325,7 +325,7 @@ namespace winrt::TerminalApp::implementation
// //
// So DON'T ~give a mouse a cookie~ take a static ref here. // So DON'T ~give a mouse a cookie~ take a static ref here.
const winrt::hstring modifiedBasename{ std::filesystem::path{ fileModified }.filename().c_str() }; const auto modifiedBasename = std::filesystem::path{ fileModified }.filename();
if (modifiedBasename == settingsBasename) if (modifiedBasename == settingsBasename)
{ {

View File

@ -626,7 +626,7 @@ namespace winrt::TerminalApp::implementation
automationPeer.RaiseNotificationEvent( automationPeer.RaiseNotificationEvent(
Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::CurrentThenMostRecent, Automation::Peers::AutomationNotificationProcessing::CurrentThenMostRecent,
fmt::format(std::wstring_view{ RS_(L"CommandPalette_NestedCommandAnnouncement") }, ParentCommandName()), RS_fmt(L"CommandPalette_NestedCommandAnnouncement", ParentCommandName()),
L"CommandPaletteNestingLevelChanged" /* unique name for this notification category */); L"CommandPaletteNestingLevelChanged" /* unique name for this notification category */);
} }
} }
@ -879,7 +879,7 @@ namespace winrt::TerminalApp::implementation
Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
currentNeedleHasResults ? currentNeedleHasResults ?
winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_MatchesAvailable") }, _filteredActions.Size()) } : winrt::hstring{ RS_fmt(L"CommandPalette_MatchesAvailable", _filteredActions.Size()) } :
NoMatchesText(), // what to announce if results were found NoMatchesText(), // what to announce if results were found
L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */); L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */);
} }

View File

@ -121,7 +121,7 @@ void Jumplist::_updateProfiles(IObjectCollection* jumplistItems, winrt::Windows:
for (const auto& profile : profiles) for (const auto& profile : profiles)
{ {
// Craft the arguments following "wt.exe" // Craft the arguments following "wt.exe"
auto args = fmt::format(L"-p {}", to_hstring(profile.Guid())); auto args = fmt::format(FMT_COMPILE(L"-p {}"), to_hstring(profile.Guid()));
// Create the shell link object for the profile // Create the shell link object for the profile
const auto normalizedIconPath{ _normalizeIconPath(profile.Icon()) }; const auto normalizedIconPath{ _normalizeIconPath(profile.Icon()) };

View File

@ -97,7 +97,7 @@ namespace winrt::TerminalApp::implementation
{ {
if (const auto& sendInput{ command.ActionAndArgs().Args().try_as<winrt::Microsoft::Terminal::Settings::Model::SendInputArgs>() }) if (const auto& sendInput{ command.ActionAndArgs().Args().try_as<winrt::Microsoft::Terminal::Settings::Model::SendInputArgs>() })
{ {
return winrt::hstring{ til::visualize_nonspace_control_codes(sendInput.Input().c_str()) }; return winrt::hstring{ til::visualize_nonspace_control_codes(std::wstring{ sendInput.Input() }) };
} }
} }
} }

View File

@ -654,7 +654,7 @@ namespace winrt::TerminalApp::implementation
automationPeer.RaiseNotificationEvent( automationPeer.RaiseNotificationEvent(
Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::CurrentThenMostRecent, Automation::Peers::AutomationNotificationProcessing::CurrentThenMostRecent,
fmt::format(std::wstring_view{ RS_(L"SuggestionsControl_NestedCommandAnnouncement") }, ParentCommandName()), RS_fmt(L"SuggestionsControl_NestedCommandAnnouncement", ParentCommandName()),
L"SuggestionsControlNestingLevelChanged" /* unique name for this notification category */); L"SuggestionsControlNestingLevelChanged" /* unique name for this notification category */);
} }
} }
@ -810,7 +810,7 @@ namespace winrt::TerminalApp::implementation
Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
currentNeedleHasResults ? currentNeedleHasResults ?
winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"SuggestionsControl_MatchesAvailable") }, _filteredActions.Size()) } : winrt::hstring{ RS_fmt(L"SuggestionsControl_MatchesAvailable", _filteredActions.Size()) } :
NoMatchesText(), // what to announce if results were found NoMatchesText(), // what to announce if results were found
L"SuggestionsControlResultAnnouncement" /* unique name for this group of notifications */); L"SuggestionsControlResultAnnouncement" /* unique name for this group of notifications */);
} }

View File

@ -1035,7 +1035,7 @@ namespace winrt::TerminalApp::implementation
const auto tabTitle = tab.Title(); const auto tabTitle = tab.Title();
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted, autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"TerminalPage_TabMovedAnnouncement_Direction") }, tabTitle, newTabIndex + 1), RS_fmt(L"TerminalPage_TabMovedAnnouncement_Direction", tabTitle, newTabIndex + 1),
L"TerminalPageMoveTabWithDirection" /* unique name for this notification category */); L"TerminalPageMoveTabWithDirection" /* unique name for this notification category */);
} }
} }

View File

@ -2148,7 +2148,7 @@ namespace winrt::TerminalApp::implementation
{ {
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted, autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"TerminalPage_PaneMovedAnnouncement_ExistingWindow2") }, windowId), RS_fmt(L"TerminalPage_PaneMovedAnnouncement_ExistingWindow2", windowId),
L"TerminalPageMovePaneToExistingWindow" /* unique name for this notification category */); L"TerminalPageMovePaneToExistingWindow" /* unique name for this notification category */);
} }
} }
@ -2183,7 +2183,7 @@ namespace winrt::TerminalApp::implementation
const auto tabTitle = targetTab->Title(); const auto tabTitle = targetTab->Title();
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted, autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"TerminalPage_PaneMovedAnnouncement_ExistingTab") }, tabTitle), RS_fmt(L"TerminalPage_PaneMovedAnnouncement_ExistingTab", tabTitle),
L"TerminalPageMovePaneToExistingTab" /* unique name for this notification category */); L"TerminalPageMovePaneToExistingTab" /* unique name for this notification category */);
} }
} }
@ -2283,14 +2283,14 @@ namespace winrt::TerminalApp::implementation
{ {
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted, autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"TerminalPage_TabMovedAnnouncement_NewWindow") }, tabTitle), RS_fmt(L"TerminalPage_TabMovedAnnouncement_NewWindow", tabTitle),
L"TerminalPageMoveTabToNewWindow" /* unique name for this notification category */); L"TerminalPageMoveTabToNewWindow" /* unique name for this notification category */);
} }
else else
{ {
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted, autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"TerminalPage_TabMovedAnnouncement_Default") }, tabTitle, windowId), RS_fmt(L"TerminalPage_TabMovedAnnouncement_Default", tabTitle, windowId),
L"TerminalPageMoveTabToExistingWindow" /* unique name for this notification category */); L"TerminalPageMoveTabToExistingWindow" /* unique name for this notification category */);
} }
} }
@ -2831,7 +2831,7 @@ namespace winrt::TerminalApp::implementation
{ {
try try
{ {
auto parsed = winrt::Windows::Foundation::Uri(eventArgs.Uri().c_str()); auto parsed = winrt::Windows::Foundation::Uri(eventArgs.Uri());
if (_IsUriSupported(parsed)) if (_IsUriSupported(parsed))
{ {
ShellExecute(nullptr, L"open", eventArgs.Uri().c_str(), nullptr, nullptr, SW_SHOWNORMAL); ShellExecute(nullptr, L"open", eventArgs.Uri().c_str(), nullptr, nullptr, SW_SHOWNORMAL);
@ -4176,8 +4176,8 @@ namespace winrt::TerminalApp::implementation
winrt::hstring TerminalPage::KeyboardServiceDisabledText() winrt::hstring TerminalPage::KeyboardServiceDisabledText()
{ {
const auto serviceName{ _getTabletServiceName() }; const auto serviceName{ _getTabletServiceName() };
const winrt::hstring text{ fmt::format(std::wstring_view(RS_(L"KeyboardServiceWarningText")), serviceName) }; const auto text{ RS_fmt(L"KeyboardServiceWarningText", serviceName) };
return text; return winrt::hstring{ text };
} }
// Method Description: // Method Description:
@ -4467,7 +4467,7 @@ namespace winrt::TerminalApp::implementation
// Build the commandline to pass to wt for this set of NewTerminalArgs // Build the commandline to pass to wt for this set of NewTerminalArgs
auto cmdline{ auto cmdline{
fmt::format(L"new-tab {}", newTerminalArgs.ToCommandline().c_str()) fmt::format(FMT_COMPILE(L"new-tab {}"), newTerminalArgs.ToCommandline())
}; };
wil::unique_process_information pi; wil::unique_process_information pi;
@ -5221,7 +5221,7 @@ namespace winrt::TerminalApp::implementation
{ {
// `this` is safe to use in here. // `this` is safe to use in here.
_sendDraggedTabToWindow(winrt::hstring{ fmt::format(L"{}", args.TargetWindow()) }, _sendDraggedTabToWindow(winrt::to_hstring(args.TargetWindow()),
args.TabIndex(), args.TabIndex(),
std::nullopt); std::nullopt);
} }

View File

@ -1873,7 +1873,7 @@ namespace winrt::TerminalApp::implementation
const auto profileName{ control.Settings().ProfileName() }; const auto profileName{ control.Settings().ProfileName() };
if (profileName != Title()) if (profileName != Title())
{ {
return fmt::format(L"{}: {}", profileName, Title()).data(); return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}: {}"), profileName, Title()) };
} }
} }

View File

@ -1362,7 +1362,7 @@ namespace winrt::TerminalApp::implementation
// - a string for displaying the name of the window. // - a string for displaying the name of the window.
winrt::hstring WindowProperties::WindowIdForDisplay() const noexcept winrt::hstring WindowProperties::WindowIdForDisplay() const noexcept
{ {
return winrt::hstring{ fmt::format(L"{}: {}", return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}: {}"),
std::wstring_view(RS_(L"WindowIdLabel")), std::wstring_view(RS_(L"WindowIdLabel")),
_WindowId) }; _WindowId) };
} }
@ -1376,7 +1376,7 @@ namespace winrt::TerminalApp::implementation
winrt::hstring WindowProperties::WindowNameForDisplay() const noexcept winrt::hstring WindowProperties::WindowNameForDisplay() const noexcept
{ {
return _WindowName.empty() ? return _WindowName.empty() ?
winrt::hstring{ fmt::format(L"<{}>", RS_(L"UnnamedWindowName")) } : winrt::hstring{ fmt::format(FMT_COMPILE(L"<{}>"), RS_(L"UnnamedWindowName")) } :
_WindowName; _WindowName;
} }

View File

@ -37,7 +37,7 @@ static constexpr winrt::guid AzureConnectionType = { 0xd9fcfdfa, 0xa479, 0x412c,
static inline std::wstring _colorize(const unsigned int colorCode, const std::wstring_view text) static inline std::wstring _colorize(const unsigned int colorCode, const std::wstring_view text)
{ {
return fmt::format(L"\x1b[{0}m{1}\x1b[m", colorCode, text); return fmt::format(FMT_COMPILE(L"\x1b[{0}m{1}\x1b[m"), colorCode, text);
} }
// Takes N resource names, loads the first one as a format string, and then // Takes N resource names, loads the first one as a format string, and then
@ -47,15 +47,18 @@ static inline std::wstring _colorize(const unsigned int colorCode, const std::ws
template<typename... Args> template<typename... Args>
static inline std::wstring _formatResWithColoredUserInputOptions(const std::wstring_view resourceKey, Args&&... args) static inline std::wstring _formatResWithColoredUserInputOptions(const std::wstring_view resourceKey, Args&&... args)
{ {
return fmt::format(std::wstring_view{ GetLibraryResourceString(resourceKey) }, (_colorize(USER_INPUT_COLOR, GetLibraryResourceString(args)))...); const auto format = GetLibraryResourceString(resourceKey);
return fmt::format(fmt::runtime(std::wstring_view{ format }), (_colorize(USER_INPUT_COLOR, GetLibraryResourceString(args)))...);
} }
static inline std::wstring _formatTenant(int tenantNumber, const Tenant& tenant) static inline std::wstring _formatTenant(int tenantNumber, const Tenant& tenant)
{ {
return fmt::format(std::wstring_view{ RS_(L"AzureIthTenant") }, return RS_fmt(
L"AzureIthTenant",
_colorize(USER_INPUT_COLOR, std::to_wstring(tenantNumber)), _colorize(USER_INPUT_COLOR, std::to_wstring(tenantNumber)),
_colorize(USER_INFO_COLOR, tenant.DisplayName.value_or(std::wstring{ RS_(L"AzureUnknownTenantName") })), _colorize(USER_INFO_COLOR, tenant.DisplayName.value_or(std::wstring{ RS_(L"AzureUnknownTenantName") })),
tenant.DefaultDomain.value_or(tenant.ID)); // use the domain name if possible, ID if not. tenant.DefaultDomain.value_or(tenant.ID) // use the domain name if possible, ID if not.
);
} }
namespace winrt::Microsoft::Terminal::TerminalConnection::implementation namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
@ -244,7 +247,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
} }
else // We only transition to Connected when we've established the websocket. else // We only transition to Connected when we've established the websocket.
{ {
auto uri{ fmt::format(L"{}terminals/{}/size?cols={}&rows={}&version=2019-01-01", _cloudShellUri, _terminalID, columns, rows) }; auto uri{ fmt::format(FMT_COMPILE(L"{}terminals/{}/size?cols={}&rows={}&version=2019-01-01"), _cloudShellUri, _terminalID, columns, rows) };
WWH::HttpStringContent content{ WWH::HttpStringContent content{
L"", L"",
@ -851,7 +854,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - the response to the device code flow initiation // - the response to the device code flow initiation
WDJ::JsonObject AzureConnection::_GetDeviceCode() WDJ::JsonObject AzureConnection::_GetDeviceCode()
{ {
auto uri{ fmt::format(L"{}common/oauth2/devicecode", _loginUri) }; auto uri{ fmt::format(FMT_COMPILE(L"{}common/oauth2/devicecode"), _loginUri) };
WWH::HttpFormUrlEncodedContent content{ WWH::HttpFormUrlEncodedContent content{
std::unordered_map<winrt::hstring, winrt::hstring>{ std::unordered_map<winrt::hstring, winrt::hstring>{
{ winrt::hstring{ L"client_id" }, winrt::hstring{ AzureClientID } }, { winrt::hstring{ L"client_id" }, winrt::hstring{ AzureClientID } },
@ -872,7 +875,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - else, throw an exception // - else, throw an exception
WDJ::JsonObject AzureConnection::_WaitForUser(const winrt::hstring& deviceCode, int pollInterval, int expiresIn) WDJ::JsonObject AzureConnection::_WaitForUser(const winrt::hstring& deviceCode, int pollInterval, int expiresIn)
{ {
auto uri{ fmt::format(L"{}common/oauth2/token", _loginUri) }; auto uri{ fmt::format(FMT_COMPILE(L"{}common/oauth2/token"), _loginUri) };
WWH::HttpFormUrlEncodedContent content{ WWH::HttpFormUrlEncodedContent content{
std::unordered_map<winrt::hstring, winrt::hstring>{ std::unordered_map<winrt::hstring, winrt::hstring>{
{ winrt::hstring{ L"grant_type" }, winrt::hstring{ L"device_code" } }, { winrt::hstring{ L"grant_type" }, winrt::hstring{ L"device_code" } },
@ -923,7 +926,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - the response which contains a list of the user's Azure tenants // - the response which contains a list of the user's Azure tenants
void AzureConnection::_PopulateTenantList() void AzureConnection::_PopulateTenantList()
{ {
auto uri{ fmt::format(L"{}tenants?api-version=2020-01-01", _resourceUri) }; auto uri{ fmt::format(FMT_COMPILE(L"{}tenants?api-version=2020-01-01"), _resourceUri) };
// Send the request and return the response as a json value // Send the request and return the response as a json value
auto tenantResponse{ _SendRequestReturningJson(uri, nullptr) }; auto tenantResponse{ _SendRequestReturningJson(uri, nullptr) };
@ -939,7 +942,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - the response with the new tokens // - the response with the new tokens
void AzureConnection::_RefreshTokens() void AzureConnection::_RefreshTokens()
{ {
auto uri{ fmt::format(L"{}{}/oauth2/token", _loginUri, _currentTenant->ID) }; auto uri{ fmt::format(FMT_COMPILE(L"{}{}/oauth2/token"), _loginUri, _currentTenant->ID) };
WWH::HttpFormUrlEncodedContent content{ WWH::HttpFormUrlEncodedContent content{
std::unordered_map<winrt::hstring, winrt::hstring>{ std::unordered_map<winrt::hstring, winrt::hstring>{
{ winrt::hstring{ L"grant_type" }, winrt::hstring{ L"refresh_token" } }, { winrt::hstring{ L"grant_type" }, winrt::hstring{ L"refresh_token" } },
@ -962,7 +965,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - the user's cloud shell settings // - the user's cloud shell settings
WDJ::JsonObject AzureConnection::_GetCloudShellUserSettings() WDJ::JsonObject AzureConnection::_GetCloudShellUserSettings()
{ {
auto uri{ fmt::format(L"{}providers/Microsoft.Portal/userSettings/cloudconsole?api-version=2023-02-01-preview", _resourceUri) }; auto uri{ fmt::format(FMT_COMPILE(L"{}providers/Microsoft.Portal/userSettings/cloudconsole?api-version=2023-02-01-preview"), _resourceUri) };
return _SendRequestReturningJson(uri, nullptr); return _SendRequestReturningJson(uri, nullptr);
} }
@ -972,7 +975,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - the uri for the cloud shell // - the uri for the cloud shell
winrt::hstring AzureConnection::_GetCloudShell() winrt::hstring AzureConnection::_GetCloudShell()
{ {
auto uri{ fmt::format(L"{}providers/Microsoft.Portal/consoles/default?api-version=2023-02-01-preview", _resourceUri) }; auto uri{ fmt::format(FMT_COMPILE(L"{}providers/Microsoft.Portal/consoles/default?api-version=2023-02-01-preview"), _resourceUri) };
WWH::HttpStringContent content{ WWH::HttpStringContent content{
LR"-({"properties": {"osType": "linux"}})-", LR"-({"properties": {"osType": "linux"}})-",
@ -992,7 +995,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
// - the uri for the terminal // - the uri for the terminal
winrt::hstring AzureConnection::_GetTerminal(const winrt::hstring& shellType) winrt::hstring AzureConnection::_GetTerminal(const winrt::hstring& shellType)
{ {
auto uri{ fmt::format(L"{}terminals?cols={}&rows={}&version=2019-01-01&shell={}", _cloudShellUri, _initialCols, _initialRows, shellType) }; auto uri{ fmt::format(FMT_COMPILE(L"{}terminals?cols={}&rows={}&version=2019-01-01&shell={}"), _cloudShellUri, _initialCols, _initialRows, shellType) };
WWH::HttpStringContent content{ WWH::HttpStringContent content{
L"{}", L"{}",

View File

@ -14,10 +14,6 @@
#include "ConptyConnection.g.cpp" #include "ConptyConnection.g.cpp"
using namespace ::Microsoft::Console; using namespace ::Microsoft::Console;
using namespace std::string_view_literals;
// Format is: "DecimalResult (HexadecimalForm)"
static constexpr auto _errorFormat = L"{0} ({0:#010x})"sv;
// Notes: // Notes:
// There is a number of ways that the Conpty connection can be terminated (voluntarily or not): // There is a number of ways that the Conpty connection can be terminated (voluntarily or not):
@ -77,7 +73,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
std::set<std::wstring, til::env_key_sorter> keys{}; std::set<std::wstring, til::env_key_sorter> keys{};
for (const auto item : _environment) for (const auto item : _environment)
{ {
keys.insert(item.Key().c_str()); keys.insert(std::wstring{ item.Key() });
} }
// add additional env vars // add additional env vars
for (const auto& key : keys) for (const auto& key : keys)
@ -422,16 +418,13 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
const auto hr = wil::ResultFromCaughtException(); const auto hr = wil::ResultFromCaughtException();
// GH#11556 - make sure to format the error code to this string as an UNSIGNED int // GH#11556 - make sure to format the error code to this string as an UNSIGNED int
winrt::hstring failureText{ fmt::format(std::wstring_view{ RS_(L"ProcessFailedToLaunch") }, const auto failureText = RS_fmt(L"ProcessFailedToLaunch", _formatStatus(hr), _commandline);
fmt::format(_errorFormat, static_cast<unsigned int>(hr)),
_commandline) };
TerminalOutput.raise(failureText); TerminalOutput.raise(failureText);
// If the path was invalid, let's present an informative message to the user // If the path was invalid, let's present an informative message to the user
if (hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY)) if (hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY))
{ {
winrt::hstring badPathText{ fmt::format(std::wstring_view{ RS_(L"BadPathText") }, const auto badPathText = RS_fmt(L"BadPathText", _startingDirectory);
_startingDirectory) };
TerminalOutput.raise(L"\r\n"); TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(badPathText); TerminalOutput.raise(badPathText);
} }
@ -451,7 +444,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
try try
{ {
// GH#11556 - make sure to format the error code to this string as an UNSIGNED int // GH#11556 - make sure to format the error code to this string as an UNSIGNED int
const auto msg1 = fmt::format(std::wstring_view{ RS_(L"ProcessExited") }, fmt::format(_errorFormat, status)); const auto msg1 = RS_fmt(L"ProcessExited", _formatStatus(status));
const auto msg2 = RS_(L"CtrlDToClose"); const auto msg2 = RS_(L"CtrlDToClose");
const auto msg = fmt::format(FMT_COMPILE(L"\r\n{}\r\n{}\r\n"), msg1, msg2); const auto msg = fmt::format(FMT_COMPILE(L"\r\n{}\r\n{}\r\n"), msg1, msg2);
TerminalOutput.raise(msg); TerminalOutput.raise(msg);
@ -459,6 +452,11 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
CATCH_LOG(); CATCH_LOG();
} }
std::wstring ConptyConnection::_formatStatus(uint32_t status)
{
return fmt::format(FMT_COMPILE(L"{0} ({0:#010x})"), status);
}
// Method Description: // Method Description:
// - called when the client application (not necessarily its pty) exits for any reason // - called when the client application (not necessarily its pty) exits for any reason
void ConptyConnection::_LastConPtyClientDisconnected() noexcept void ConptyConnection::_LastConPtyClientDisconnected() noexcept

View File

@ -60,6 +60,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
HRESULT _LaunchAttachedClient() noexcept; HRESULT _LaunchAttachedClient() noexcept;
void _indicateExitWithStatus(unsigned int status) noexcept; void _indicateExitWithStatus(unsigned int status) noexcept;
static std::wstring _formatStatus(uint32_t status);
void _LastConPtyClientDisconnected() noexcept; void _LastConPtyClientDisconnected() noexcept;
til::CoordType _rows = 120; til::CoordType _rows = 120;

View File

@ -487,7 +487,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
} }
else else
{ {
currentString = fmt::format(L"{}", currentMatch + 1); currentString = fmt::to_wstring(currentMatch + 1);
} }
if (totalMatches > MaximumTotalResultsToShowInStatus) if (totalMatches > MaximumTotalResultsToShowInStatus)
@ -496,10 +496,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
} }
else else
{ {
totalString = fmt::format(L"{}", totalMatches); totalString = fmt::to_wstring(totalMatches);
} }
return winrt::hstring{ fmt::format(RS_(L"TermControl_NumResults").c_str(), currentString, totalString) }; return winrt::hstring{ RS_fmt(L"TermControl_NumResults", currentString, totalString) };
} }
// Method Description: // Method Description:

View File

@ -1203,13 +1203,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{ {
case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND): case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND):
case HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND): case HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND):
message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"PixelShaderNotFound") }, parameter) }; message = RS_fmt(L"PixelShaderNotFound", parameter);
break; break;
case D2DERR_SHADER_COMPILE_FAILED: case D2DERR_SHADER_COMPILE_FAILED:
message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"PixelShaderCompileFailed") }, parameter) }; message = RS_fmt(L"PixelShaderCompileFailed", parameter);
break; break;
case DWRITE_E_NOFONT: case DWRITE_E_NOFONT:
message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"RendererErrorFontNotFound") }, parameter) }; message = RS_fmt(L"RendererErrorFontNotFound", parameter);
break; break;
case ATLAS_ENGINE_ERROR_MAC_TYPE: case ATLAS_ENGINE_ERROR_MAC_TYPE:
message = RS_(L"RendererErrorMacType"); message = RS_(L"RendererErrorMacType");
@ -1219,9 +1219,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
wchar_t buf[512]; wchar_t buf[512];
const auto len = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &buf[0], ARRAYSIZE(buf), nullptr); const auto len = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &buf[0], ARRAYSIZE(buf), nullptr);
const std::wstring_view msg{ &buf[0], len }; const std::wstring_view msg{ &buf[0], len };
std::wstring resourceString = RS_(L"RendererErrorOther").c_str();
//conditional message construction //conditional message construction
std::wstring partialMessage = fmt::format(std::wstring_view{ resourceString }, hr, msg); auto partialMessage = RS_fmt(L"RendererErrorOther", hr, msg);
if (!parameter.empty()) if (!parameter.empty())
{ {
fmt::format_to(std::back_inserter(partialMessage), LR"( "{0}")", parameter); fmt::format_to(std::back_inserter(partialMessage), LR"( "{0}")", parameter);
@ -3854,7 +3853,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
automationPeer.RaiseNotificationEvent( automationPeer.RaiseNotificationEvent(
AutomationNotificationKind::ItemAdded, AutomationNotificationKind::ItemAdded,
AutomationNotificationProcessing::All, AutomationNotificationProcessing::All,
winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"PreviewTextAnnouncement") }, text) }, RS_fmt(L"PreviewTextAnnouncement", text),
L"PreviewTextAnnouncement" /* unique name for this group of notifications */); L"PreviewTextAnnouncement" /* unique name for this group of notifications */);
} }
} }

View File

@ -57,7 +57,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{ {
if (IsDefaultScheme()) if (IsDefaultScheme())
{ {
return hstring{ fmt::format(L"{0} ({1})", Name(), RS_(L"ColorScheme_DefaultTag/Text")) }; return hstring{ fmt::format(FMT_COMPILE(L"{} ({})"), Name(), RS_(L"ColorScheme_DefaultTag/Text")) };
} }
return Name(); return Name();
} }

View File

@ -97,7 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Editor::ColorSchemeViewModel ColorSchemesPageViewModel::RequestAddNew() Editor::ColorSchemeViewModel ColorSchemesPageViewModel::RequestAddNew()
{ {
const hstring schemeName{ fmt::format(L"Color Scheme {}", _settings.GlobalSettings().ColorSchemes().Size() + 1) }; const auto schemeName{ fmt::format(FMT_COMPILE(L"Color Scheme {}"), _settings.GlobalSettings().ColorSchemes().Size() + 1) };
Model::ColorScheme scheme{ schemeName }; Model::ColorScheme scheme{ schemeName };
// Add the new color scheme // Add the new color scheme

View File

@ -49,17 +49,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// Append the launch position part // Append the launch position part
if (UseDefaultLaunchPosition()) if (UseDefaultLaunchPosition())
{ {
result = fmt::format(L"{}, {}", launchModeString, RS_(L"Globals_DefaultLaunchPositionCheckbox/Content")); result = fmt::format(FMT_COMPILE(L"{}, {}"), launchModeString, RS_(L"Globals_DefaultLaunchPositionCheckbox/Content"));
} }
else else
{ {
const std::wstring xPosString = isnan(InitialPosX()) ? RS_(L"Globals_LaunchModeDefault/Content").c_str() : std::to_wstring(gsl::narrow_cast<int>(InitialPosX())); const auto xPosString = isnan(InitialPosX()) ? RS_(L"Globals_LaunchModeDefault/Content") : winrt::to_hstring(gsl::narrow_cast<int>(InitialPosX()));
const std::wstring yPosString = isnan(InitialPosY()) ? RS_(L"Globals_LaunchModeDefault/Content").c_str() : std::to_wstring(gsl::narrow_cast<int>(InitialPosY())); const auto yPosString = isnan(InitialPosY()) ? RS_(L"Globals_LaunchModeDefault/Content") : winrt::to_hstring(gsl::narrow_cast<int>(InitialPosY()));
result = fmt::format(L"{}, ({},{})", launchModeString, xPosString, yPosString); result = fmt::format(FMT_COMPILE(L"{}, ({},{})"), launchModeString, xPosString, yPosString);
} }
// Append the CenterOnLaunch part // Append the CenterOnLaunch part
result = CenterOnLaunch() ? winrt::hstring{ fmt::format(L"{}, {}", result, RS_(L"Globals_CenterOnLaunchCentered")) } : result; result = CenterOnLaunch() ? winrt::hstring{ fmt::format(FMT_COMPILE(L"{}, {}"), result, RS_(L"Globals_CenterOnLaunchCentered")) } : result;
return result; return result;
} }

View File

@ -255,7 +255,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
if (originTag == Model::OriginTag::Fragment || originTag == Model::OriginTag::Generated) if (originTag == Model::OriginTag::Fragment || originTag == Model::OriginTag::Generated)
{ {
// from a fragment extension or generated profile // from a fragment extension or generated profile
return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideMessageFragmentExtension") }, source) }; return hstring{ RS_fmt(L"SettingContainer_OverrideMessageFragmentExtension", source) };
} }
return RS_(L"SettingContainer_OverrideMessageBaseLayer"); return RS_(L"SettingContainer_OverrideMessageBaseLayer");
} }

View File

@ -8,6 +8,7 @@
#include "HashUtils.h" #include "HashUtils.h"
#include <LibraryResources.h> #include <LibraryResources.h>
#include <til/static_map.h>
static constexpr std::string_view AdjustFontSizeKey{ "adjustFontSize" }; static constexpr std::string_view AdjustFontSizeKey{ "adjustFontSize" };
static constexpr std::string_view CloseOtherPanesKey{ "closeOtherPanes" }; static constexpr std::string_view CloseOtherPanesKey{ "closeOtherPanes" };
@ -105,52 +106,48 @@ static constexpr std::string_view ActionKey{ "action" };
// This key is reserved to remove a keybinding, instead of mapping it to an action. // This key is reserved to remove a keybinding, instead of mapping it to an action.
static constexpr std::string_view UnboundKey{ "unbound" }; static constexpr std::string_view UnboundKey{ "unbound" };
#define KEY_TO_ACTION_PAIR(action) { action##Key, ShortcutAction::action },
#define ACTION_TO_KEY_PAIR(action) { ShortcutAction::action, action##Key },
#define ACTION_TO_SERIALIZERS_PAIR(action) { ShortcutAction::action, { action##Args::FromJson, action##Args::ToJson } },
namespace winrt::Microsoft::Terminal::Settings::Model::implementation namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
using namespace ::Microsoft::Terminal::Settings::Model; using namespace ::Microsoft::Terminal::Settings::Model;
// Specifically use a map here over an unordered_map. We want to be able to using ParseActionFunction = FromJsonResult (*)(const Json::Value&);
// iterate over these entries in-order when we're serializing the keybindings. using SerializeActionFunction = Json::Value (*)(const IActionArgs&);
// HERE BE DRAGONS:
// These are string_views that are being used as keys. These string_views are using KeyToActionPair = std::pair<std::string_view, ShortcutAction>;
// just pointers to other strings. This could be dangerous, if the map outlived using ActionToKeyPair = std::pair<ShortcutAction, std::string_view>;
// the actual strings being pointed to. However, since both these strings and using SerializersPair = std::pair<ParseActionFunction, SerializeActionFunction>;
// the map are all const for the lifetime of the app, we have nothing to worry using ActionToSerializersPair = std::pair<ShortcutAction, SerializersPair>;
// about here.
const std::map<std::string_view, ShortcutAction, std::less<>> ActionAndArgs::ActionKeyNamesMap{ #define KEY_TO_ACTION_PAIR(action) KeyToActionPair{ action##Key, ShortcutAction::action },
#define ACTION_TO_KEY_PAIR(action) ActionToKeyPair{ ShortcutAction::action, action##Key },
#define ACTION_TO_SERIALIZERS_PAIR(action) ActionToSerializersPair{ ShortcutAction::action, { action##Args::FromJson, action##Args::ToJson } },
static constexpr til::static_map ActionKeyNamesMap{
#define ON_ALL_ACTIONS(action) KEY_TO_ACTION_PAIR(action) #define ON_ALL_ACTIONS(action) KEY_TO_ACTION_PAIR(action)
ALL_SHORTCUT_ACTIONS ALL_SHORTCUT_ACTIONS
// Don't include the INTERNAL_SHORTCUT_ACTIONS here // Don't include the INTERNAL_SHORTCUT_ACTIONS here
#undef ON_ALL_ACTIONS #undef ON_ALL_ACTIONS
}; };
static const std::map<ShortcutAction, std::string_view, std::less<>> ActionToStringMap{ static constexpr til::static_map ActionToStringMap{
#define ON_ALL_ACTIONS(action) ACTION_TO_KEY_PAIR(action) #define ON_ALL_ACTIONS(action) ACTION_TO_KEY_PAIR(action)
ALL_SHORTCUT_ACTIONS ALL_SHORTCUT_ACTIONS
// Don't include the INTERNAL_SHORTCUT_ACTIONS here // Don't include the INTERNAL_SHORTCUT_ACTIONS here
#undef ON_ALL_ACTIONS #undef ON_ALL_ACTIONS
}; };
using ParseResult = std::tuple<IActionArgs, std::vector<SettingsLoadWarnings>>;
using ParseActionFunction = std::function<ParseResult(const Json::Value&)>;
using SerializeActionFunction = std::function<Json::Value(IActionArgs)>;
// This is a map of ShortcutAction->{function<IActionArgs(Json::Value)>, function<Json::Value(IActionArgs)>. It holds // This is a map of ShortcutAction->{function<IActionArgs(Json::Value)>, function<Json::Value(IActionArgs)>. It holds
// a set of (de)serializer functions that can be used to (de)serialize an IActionArgs // a set of (de)serializer functions that can be used to (de)serialize an IActionArgs
// from json. Each type of IActionArgs that can accept arbitrary args should be // from json. Each type of IActionArgs that can accept arbitrary args should be
// placed into this map, with the corresponding deserializer function as the // placed into this map, with the corresponding deserializer function as the
// value. // value.
static const std::unordered_map<ShortcutAction, std::pair<ParseActionFunction, SerializeActionFunction>> argSerializerMap{ static constexpr til::static_map argSerializerMap{
// These are special cases. // These are special cases.
// - QuakeMode: deserializes into a GlobalSummon, so we don't need a serializer // - QuakeMode: deserializes into a GlobalSummon, so we don't need a serializer
// - Invalid: has no args // - Invalid: has no args
{ ShortcutAction::QuakeMode, { GlobalSummonArgs::QuakeModeFromJson, nullptr } }, ActionToSerializersPair{ ShortcutAction::QuakeMode, { &GlobalSummonArgs::QuakeModeFromJson, nullptr } },
{ ShortcutAction::Invalid, { nullptr, nullptr } }, ActionToSerializersPair{ ShortcutAction::Invalid, { nullptr, nullptr } },
#define ON_ALL_ACTIONS_WITH_ARGS(action) ACTION_TO_SERIALIZERS_PAIR(action) #define ON_ALL_ACTIONS_WITH_ARGS(action) ACTION_TO_SERIALIZERS_PAIR(action)
ALL_SHORTCUT_ACTIONS_WITH_ARGS ALL_SHORTCUT_ACTIONS_WITH_ARGS
@ -198,8 +195,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
// Try matching the command to one we have. If we can't find the // Try matching the command to one we have. If we can't find the
// action name in our list of names, let's just unbind that key. // action name in our list of names, let's just unbind that key.
const auto found = ActionAndArgs::ActionKeyNamesMap.find(actionString); const auto found = ActionKeyNamesMap.find(actionString);
return found != ActionAndArgs::ActionKeyNamesMap.end() ? found->second : ShortcutAction::Invalid; return found != ActionKeyNamesMap.end() ? found->second : ShortcutAction::Invalid;
} }
// Method Description: // Method Description:
@ -468,7 +465,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (_Action != ShortcutAction::Invalid) if (_Action != ShortcutAction::Invalid)
{ {
auto actionKeyString = ActionToStringMap.find(_Action)->second; auto actionKeyString = ActionToStringMap.find(_Action)->second;
auto result = fmt::format(FMT_COMPILE(L"User.{}"), actionKeyString); auto result = fmt::format(FMT_COMPILE(L"User.{}"), winrt::to_hstring(actionKeyString));
if (_Args) if (_Args)
{ {
// If there are args, we need to append the hash of the args // If there are args, we need to append the hash of the args

View File

@ -11,7 +11,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
struct ActionAndArgs : public ActionAndArgsT<ActionAndArgs> struct ActionAndArgs : public ActionAndArgsT<ActionAndArgs>
{ {
static const std::map<std::string_view, ShortcutAction, std::less<>> ActionKeyNamesMap;
static winrt::com_ptr<ActionAndArgs> FromJson(const Json::Value& json, static winrt::com_ptr<ActionAndArgs> FromJson(const Json::Value& json,
std::vector<SettingsLoadWarnings>& warnings); std::vector<SettingsLoadWarnings>& warnings);
static Json::Value ToJson(const Model::ActionAndArgs& val); static Json::Value ToJson(const Model::ActionAndArgs& val);

View File

@ -60,82 +60,82 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
winrt::hstring NewTerminalArgs::GenerateName() const winrt::hstring NewTerminalArgs::GenerateName() const
{ {
std::wstringstream ss; std::wstring str;
if (!Profile().empty()) if (!Profile().empty())
{ {
ss << fmt::format(L"profile: {}, ", Profile()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"profile: {}, "), Profile());
} }
else if (ProfileIndex()) else if (ProfileIndex())
{ {
ss << fmt::format(L"profile index: {}, ", ProfileIndex().Value()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"profile index: {}, "), ProfileIndex().Value());
} }
if (!Commandline().empty()) if (!Commandline().empty())
{ {
ss << fmt::format(L"commandline: {}, ", Commandline()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"commandline: {}, "), Commandline());
} }
if (!StartingDirectory().empty()) if (!StartingDirectory().empty())
{ {
ss << fmt::format(L"directory: {}, ", StartingDirectory()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"directory: {}, "), StartingDirectory());
} }
if (!TabTitle().empty()) if (!TabTitle().empty())
{ {
ss << fmt::format(L"title: {}, ", TabTitle()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"title: {}, "), TabTitle());
} }
if (TabColor()) if (TabColor())
{ {
const til::color tabColor{ TabColor().Value() }; const til::color tabColor{ TabColor().Value() };
ss << fmt::format(L"tabColor: {}, ", tabColor.ToHexString(true)); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"tabColor: {}, "), tabColor.ToHexString(true));
} }
if (!ColorScheme().empty()) if (!ColorScheme().empty())
{ {
ss << fmt::format(L"colorScheme: {}, ", ColorScheme()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"colorScheme: {}, "), ColorScheme());
} }
if (SuppressApplicationTitle()) if (SuppressApplicationTitle())
{ {
if (SuppressApplicationTitle().Value()) if (SuppressApplicationTitle().Value())
{ {
ss << fmt::format(L"suppress application title, "); str.append(L"suppress application title, ");
} }
else else
{ {
ss << fmt::format(L"use application title, "); str.append(L"use application title, ");
} }
} }
if (Elevate()) if (Elevate())
{ {
ss << fmt::format(L"elevate: {}, ", Elevate().Value()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"elevate: {}, "), Elevate().Value());
} }
auto s = ss.str(); if (str.empty())
if (s.empty())
{ {
return {}; return {};
} }
// Chop off the last ", " // Chop off the last ", "
return winrt::hstring{ s.substr(0, s.size() - 2) }; str.resize(str.size() - 2);
return winrt::hstring{ str };
} }
winrt::hstring NewTerminalArgs::ToCommandline() const winrt::hstring NewTerminalArgs::ToCommandline() const
{ {
std::wstringstream ss; std::wstring str;
if (!Profile().empty()) if (!Profile().empty())
{ {
ss << fmt::format(L"--profile \"{}\" ", Profile()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--profile \"{}\" "), Profile());
} }
if (const auto id = SessionId(); id != winrt::guid{}) if (const auto id = SessionId(); id != winrt::guid{})
{ {
const auto str = ::Microsoft::Console::Utils::GuidToString(id); const auto idStr = ::Microsoft::Console::Utils::GuidToString(id);
ss << fmt::format(L"--sessionId \"{}\" ", str); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--sessionId \"{}\" "), idStr);
} }
// The caller is always expected to provide the evaluated profile in the // The caller is always expected to provide the evaluated profile in the
@ -143,105 +143,104 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// //
// else if (ProfileIndex()) // else if (ProfileIndex())
// { // {
// ss << fmt::format(L"profile index: {}, ", ProfileIndex().Value()); // fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"profile index: {}, "), ProfileIndex().Value());
// } // }
if (!StartingDirectory().empty()) if (!StartingDirectory().empty())
{ {
ss << fmt::format(L"--startingDirectory {} ", QuoteAndEscapeCommandlineArg(StartingDirectory())); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--startingDirectory {} "), QuoteAndEscapeCommandlineArg(StartingDirectory()));
} }
if (!TabTitle().empty()) if (!TabTitle().empty())
{ {
ss << fmt::format(L"--title {} ", QuoteAndEscapeCommandlineArg(TabTitle())); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--title {} "), QuoteAndEscapeCommandlineArg(TabTitle()));
} }
if (TabColor()) if (TabColor())
{ {
const til::color tabColor{ TabColor().Value() }; const til::color tabColor{ TabColor().Value() };
ss << fmt::format(L"--tabColor \"{}\" ", tabColor.ToHexString(true)); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--tabColor \"{}\" "), tabColor.ToHexString(true));
} }
if (SuppressApplicationTitle()) if (SuppressApplicationTitle())
{ {
if (SuppressApplicationTitle().Value()) if (SuppressApplicationTitle().Value())
{ {
ss << fmt::format(L"--suppressApplicationTitle "); str.append(L"--suppressApplicationTitle ");
} }
else else
{ {
ss << fmt::format(L"--useApplicationTitle "); str.append(L"--useApplicationTitle ");
} }
} }
if (!ColorScheme().empty()) if (!ColorScheme().empty())
{ {
ss << fmt::format(L"--colorScheme {} ", QuoteAndEscapeCommandlineArg(ColorScheme())); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--colorScheme {} "), QuoteAndEscapeCommandlineArg(ColorScheme()));
} }
if (!Commandline().empty()) if (!Commandline().empty())
{ {
ss << fmt::format(L"-- \"{}\" ", Commandline()); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"-- \"{}\" "), Commandline());
} }
auto s = ss.str(); if (str.empty())
if (s.empty())
{ {
return {}; return {};
} }
// Chop off the last " " // Chop off the last " "
return winrt::hstring{ s.substr(0, s.size() - 1) }; str.resize(str.size() - 1);
return winrt::hstring{ str };
} }
winrt::hstring CopyTextArgs::GenerateName() const winrt::hstring CopyTextArgs::GenerateName() const
{ {
std::wstringstream ss; std::wstring str;
if (SingleLine()) if (SingleLine())
{ {
ss << RS_(L"CopyTextAsSingleLineCommandKey").c_str(); str.append(RS_(L"CopyTextAsSingleLineCommandKey"));
} }
else else
{ {
ss << RS_(L"CopyTextCommandKey").c_str(); str.append(RS_(L"CopyTextCommandKey"));
} }
if (!DismissSelection()) if (!DismissSelection())
{ {
ss << L", dismissSelection: false"; str.append(L", dismissSelection: false");
} }
if (CopyFormatting()) if (CopyFormatting())
{ {
ss << L", copyFormatting: "; str.append(L", copyFormatting: ");
if (CopyFormatting().Value() == CopyFormat::All) if (CopyFormatting().Value() == CopyFormat::All)
{ {
ss << L"all, "; str.append(L"all, ");
} }
else if (CopyFormatting().Value() == static_cast<CopyFormat>(0)) else if (CopyFormatting().Value() == static_cast<CopyFormat>(0))
{ {
ss << L"none, "; str.append(L"none, ");
} }
else else
{ {
if (WI_IsFlagSet(CopyFormatting().Value(), CopyFormat::HTML)) if (WI_IsFlagSet(CopyFormatting().Value(), CopyFormat::HTML))
{ {
ss << L"html, "; str.append(L"html, ");
} }
if (WI_IsFlagSet(CopyFormatting().Value(), CopyFormat::RTF)) if (WI_IsFlagSet(CopyFormatting().Value(), CopyFormat::RTF))
{ {
ss << L"rtf, "; str.append(L"rtf, ");
} }
} }
// Chop off the last ", " // Chop off the last ", "
auto result = ss.str(); str.resize(str.size() - 2);
return winrt::hstring{ result.substr(0, result.size() - 2) };
} }
return winrt::hstring{ ss.str() }; return winrt::hstring{ str };
} }
winrt::hstring NewTabArgs::GenerateName() const winrt::hstring NewTabArgs::GenerateName() const
@ -257,7 +256,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return RS_(L"NewTabCommandKey"); return RS_(L"NewTabCommandKey");
} }
return winrt::hstring{ return winrt::hstring{
fmt::format(L"{}, {}", RS_(L"NewTabCommandKey"), newTerminalArgsStr) fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"NewTabCommandKey"), newTerminalArgsStr)
}; };
} }
@ -273,11 +272,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return RS_(L"MovePaneToNewWindowCommandKey"); return RS_(L"MovePaneToNewWindowCommandKey");
} }
return winrt::hstring{ return winrt::hstring{
fmt::format(L"{}, window:{}, tab index:{}", RS_(L"MovePaneCommandKey"), Window(), TabIndex()) fmt::format(FMT_COMPILE(L"{}, window:{}, tab index:{}"), RS_(L"MovePaneCommandKey"), Window(), TabIndex())
}; };
} }
return winrt::hstring{ return winrt::hstring{
fmt::format(L"{}, tab index:{}", RS_(L"MovePaneCommandKey"), TabIndex()) fmt::format(FMT_COMPILE(L"{}, tab index:{}"), RS_(L"MovePaneCommandKey"), TabIndex())
}; };
} }
@ -289,7 +288,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
} }
return winrt::hstring{ return winrt::hstring{
fmt::format(L"{}, index:{}", RS_(L"SwitchToTabCommandKey"), TabIndex()) fmt::format(FMT_COMPILE(L"{}, index:{}"), RS_(L"SwitchToTabCommandKey"), TabIndex())
}; };
} }
@ -311,10 +310,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
directionString = RS_(L"DirectionDown"); directionString = RS_(L"DirectionDown");
break; break;
} }
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ResizePaneWithArgCommandKey", directionString) };
fmt::format(std::wstring_view(RS_(L"ResizePaneWithArgCommandKey")),
directionString)
};
} }
winrt::hstring MoveFocusArgs::GenerateName() const winrt::hstring MoveFocusArgs::GenerateName() const
@ -348,10 +344,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return RS_(L"MoveFocusChildPane"); return RS_(L"MoveFocusChildPane");
} }
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"MoveFocusWithArgCommandKey", directionString) };
fmt::format(std::wstring_view(RS_(L"MoveFocusWithArgCommandKey")),
directionString)
};
} }
winrt::hstring SwapPaneArgs::GenerateName() const winrt::hstring SwapPaneArgs::GenerateName() const
@ -381,10 +374,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return RS_(L"SwapPaneFirstPane"); return RS_(L"SwapPaneFirstPane");
} }
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"SwapPaneWithArgCommandKey", directionString) };
fmt::format(std::wstring_view(RS_(L"SwapPaneWithArgCommandKey")),
directionString)
};
} }
winrt::hstring AdjustFontSizeArgs::GenerateName() const winrt::hstring AdjustFontSizeArgs::GenerateName() const
@ -395,19 +385,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// * Decrease font size, amount: {delta}" // * Decrease font size, amount: {delta}"
if (Delta() < 0) if (Delta() < 0)
{ {
return Delta() == -1 ? RS_(L"DecreaseFontSizeCommandKey") : return Delta() == -1 ? RS_(L"DecreaseFontSizeCommandKey") : winrt::hstring{ RS_fmt(L"DecreaseFontSizeWithAmountCommandKey", -Delta()) };
winrt::hstring{
fmt::format(std::wstring_view(RS_(L"DecreaseFontSizeWithAmountCommandKey")),
-Delta())
};
} }
else else
{ {
return Delta() == 1 ? RS_(L"IncreaseFontSizeCommandKey") : return Delta() == 1 ? RS_(L"IncreaseFontSizeCommandKey") : winrt::hstring{ RS_fmt(L"IncreaseFontSizeWithAmountCommandKey", Delta()) };
winrt::hstring{
fmt::format(std::wstring_view(RS_(L"IncreaseFontSizeWithAmountCommandKey")),
Delta())
};
} }
} }
@ -416,8 +398,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// The string will be similar to the following: // The string will be similar to the following:
// * "Send Input: ...input..." // * "Send Input: ...input..."
auto escapedInput = til::visualize_control_codes(Input()); const auto escapedInput = til::visualize_control_codes(Input());
auto name = fmt::format(std::wstring_view(RS_(L"SendInputCommandKey")), escapedInput); const auto name = RS_fmt(L"SendInputCommandKey", escapedInput);
return winrt::hstring{ name }; return winrt::hstring{ name };
} }
@ -432,38 +414,38 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// If this is a "duplicate pane" action, then the new terminal arguments // If this is a "duplicate pane" action, then the new terminal arguments
// will be omitted (as they're unused) // will be omitted (as they're unused)
std::wstringstream ss; std::wstring str;
if (SplitMode() == SplitType::Duplicate) if (SplitMode() == SplitType::Duplicate)
{ {
ss << std::wstring_view(RS_(L"DuplicatePaneCommandKey")); str.append(RS_(L"DuplicatePaneCommandKey"));
} }
else else
{ {
ss << std::wstring_view(RS_(L"SplitPaneCommandKey")); str.append(RS_(L"SplitPaneCommandKey"));
} }
ss << L", "; str.append(L", ");
// This text is intentionally _not_ localized, to attempt to mirror the // This text is intentionally _not_ localized, to attempt to mirror the
// exact syntax that the property would have in JSON. // exact syntax that the property would have in JSON.
switch (SplitDirection()) switch (SplitDirection())
{ {
case SplitDirection::Up: case SplitDirection::Up:
ss << L"split: up, "; str.append(L"split: up, ");
break; break;
case SplitDirection::Right: case SplitDirection::Right:
ss << L"split: right, "; str.append(L"split: right, ");
break; break;
case SplitDirection::Down: case SplitDirection::Down:
ss << L"split: down, "; str.append(L"split: down, ");
break; break;
case SplitDirection::Left: case SplitDirection::Left:
ss << L"split: left, "; str.append(L"split: left, ");
break; break;
} }
if (SplitSize() != .5f) if (SplitSize() != .5f)
{ {
ss << L"size: " << (SplitSize() * 100) << L"%, "; fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"size: {:.2f}%, "), SplitSize() * 100);
} }
winrt::hstring newTerminalArgsStr; winrt::hstring newTerminalArgsStr;
@ -474,13 +456,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (SplitMode() != SplitType::Duplicate && !newTerminalArgsStr.empty()) if (SplitMode() != SplitType::Duplicate && !newTerminalArgsStr.empty())
{ {
ss << newTerminalArgsStr.c_str(); str.append(newTerminalArgsStr);
ss << L", "; str.append(L", ");
} }
// Chop off the last ", " // Chop off the last ", "
auto s = ss.str(); str.resize(str.size() - 2);
return winrt::hstring{ s.substr(0, s.size() - 2) }; return winrt::hstring{ str };
} }
winrt::hstring OpenSettingsArgs::GenerateName() const winrt::hstring OpenSettingsArgs::GenerateName() const
@ -531,10 +513,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// "Set color scheme to "{_SchemeName}"" // "Set color scheme to "{_SchemeName}""
if (!SchemeName().empty()) if (!SchemeName().empty())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"SetColorSchemeCommandKey", SchemeName()) };
fmt::format(std::wstring_view(RS_(L"SetColorSchemeCommandKey")),
SchemeName().c_str())
};
} }
return {}; return {};
} }
@ -546,10 +525,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (TabColor()) if (TabColor())
{ {
til::color tabColor{ TabColor().Value() }; til::color tabColor{ TabColor().Value() };
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"SetTabColorCommandKey", tabColor.ToHexString(true)) };
fmt::format(std::wstring_view(RS_(L"SetTabColorCommandKey")),
tabColor.ToHexString(true))
};
} }
return RS_(L"ResetTabColorCommandKey"); return RS_(L"ResetTabColorCommandKey");
@ -561,10 +537,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// "Reset tab title" // "Reset tab title"
if (!Title().empty()) if (!Title().empty())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"RenameTabCommandKey", Title()) };
fmt::format(std::wstring_view(RS_(L"RenameTabCommandKey")),
Title().c_str())
};
} }
return RS_(L"ResetTabNameCommandKey"); return RS_(L"ResetTabNameCommandKey");
} }
@ -574,10 +547,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// "Run commandline "{_Commandline}" in this window" // "Run commandline "{_Commandline}" in this window"
if (!Commandline().empty()) if (!Commandline().empty())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ExecuteCommandlineCommandKey", Commandline()) };
fmt::format(std::wstring_view(RS_(L"ExecuteCommandlineCommandKey")),
Commandline().c_str())
};
} }
return {}; return {};
} }
@ -587,10 +557,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (Index()) if (Index())
{ {
// "Close tabs other than index {0}" // "Close tabs other than index {0}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"CloseOtherTabsCommandKey", Index().Value()) };
fmt::format(std::wstring_view(RS_(L"CloseOtherTabsCommandKey")),
Index().Value())
};
} }
return RS_(L"CloseOtherTabsDefaultCommandKey"); return RS_(L"CloseOtherTabsDefaultCommandKey");
} }
@ -600,10 +567,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (Index()) if (Index())
{ {
// "Close tabs after index {0}" // "Close tabs after index {0}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"CloseTabsAfterCommandKey", Index().Value()) };
fmt::format(std::wstring_view(RS_(L"CloseTabsAfterCommandKey")),
Index().Value())
};
} }
return RS_(L"CloseTabsAfterDefaultCommandKey"); return RS_(L"CloseTabsAfterDefaultCommandKey");
} }
@ -613,10 +577,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (Index()) if (Index())
{ {
// "Close tab at index {0}" // "Close tab at index {0}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"CloseTabAtIndexCommandKey", Index().Value()) };
fmt::format(std::wstring_view(RS_(L"CloseTabAtIndexCommandKey")),
Index().Value())
};
} }
return RS_(L"CloseTabCommandKey"); return RS_(L"CloseTabCommandKey");
} }
@ -625,10 +586,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
if (RowsToScroll()) if (RowsToScroll())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ScrollUpSeveralRowsCommandKey", RowsToScroll().Value()) };
fmt::format(std::wstring_view(RS_(L"ScrollUpSeveralRowsCommandKey")),
RowsToScroll().Value())
};
} }
return RS_(L"ScrollUpCommandKey"); return RS_(L"ScrollUpCommandKey");
} }
@ -637,10 +595,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
if (RowsToScroll()) if (RowsToScroll())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ScrollDownSeveralRowsCommandKey", RowsToScroll().Value()) };
fmt::format(std::wstring_view(RS_(L"ScrollDownSeveralRowsCommandKey")),
RowsToScroll().Value())
};
} }
return RS_(L"ScrollDownCommandKey"); return RS_(L"ScrollDownCommandKey");
} }
@ -666,10 +621,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
if (Color()) if (Color())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"AddMarkWithColorCommandKey", til::color{ Color().Value() }.ToHexString(true)) };
fmt::format(std::wstring_view(RS_(L"AddMarkWithColorCommandKey")),
til::color{ Color().Value() }.ToHexString(true))
};
} }
else else
{ {
@ -685,10 +637,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
return RS_(L"MoveTabToNewWindowCommandKey"); return RS_(L"MoveTabToNewWindowCommandKey");
} }
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"MoveTabToWindowCommandKey", Window()) };
fmt::format(std::wstring_view(RS_(L"MoveTabToWindowCommandKey")),
Window())
};
} }
winrt::hstring directionString; winrt::hstring directionString;
@ -701,10 +650,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
directionString = RS_(L"MoveTabDirectionBackward"); directionString = RS_(L"MoveTabDirectionBackward");
break; break;
} }
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"MoveTabCommandKey", directionString) };
fmt::format(std::wstring_view(RS_(L"MoveTabCommandKey")),
directionString)
};
} }
winrt::hstring ToggleCommandPaletteArgs::GenerateName() const winrt::hstring ToggleCommandPaletteArgs::GenerateName() const
@ -718,42 +664,40 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
winrt::hstring SuggestionsArgs::GenerateName() const winrt::hstring SuggestionsArgs::GenerateName() const
{ {
std::wstringstream ss; std::wstring str;
ss << RS_(L"SuggestionsCommandKey").c_str(); str.append(RS_(L"SuggestionsCommandKey"));
if (UseCommandline()) if (UseCommandline())
{ {
ss << L", useCommandline:true"; str.append(L", useCommandline:true");
} }
// All of the source values will leave a trailing ", " that we need to chop later: // All of the source values will leave a trailing ", " that we need to chop later:
ss << L", source: "; str.append(L", source: ");
const auto source = Source(); const auto source = Source();
if (source == SuggestionsSource::All) if (source == SuggestionsSource::All)
{ {
ss << L"all, "; str.append(L"all, ");
} }
else if (source == static_cast<SuggestionsSource>(0)) else if (source == static_cast<SuggestionsSource>(0))
{ {
ss << L"none, "; str.append(L"none, ");
} }
else else
{ {
if (WI_IsFlagSet(source, SuggestionsSource::Tasks)) if (WI_IsFlagSet(source, SuggestionsSource::Tasks))
{ {
ss << L"tasks, "; str.append(L"tasks, ");
} }
if (WI_IsFlagSet(source, SuggestionsSource::CommandHistory)) if (WI_IsFlagSet(source, SuggestionsSource::CommandHistory))
{ {
ss << L"commandHistory, "; str.append(L"commandHistory, ");
} }
} }
// Chop off the last "," // Chop off the last ","
auto result = ss.str(); str.resize(str.size() - 2);
// use `resize`, to avoid duplicating the entire string. (substr doesn't create a view.) return winrt::hstring{ str };
result.resize(result.size() - 2);
return winrt::hstring{ result };
} }
winrt::hstring FindMatchArgs::GenerateName() const winrt::hstring FindMatchArgs::GenerateName() const
@ -780,9 +724,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
return RS_(L"NewWindowCommandKey"); return RS_(L"NewWindowCommandKey");
} }
return winrt::hstring{ return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"NewWindowCommandKey"), newTerminalArgsStr) };
fmt::format(L"{}, {}", RS_(L"NewWindowCommandKey"), newTerminalArgsStr)
};
} }
winrt::hstring PrevTabArgs::GenerateName() const winrt::hstring PrevTabArgs::GenerateName() const
@ -793,7 +735,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
} }
const auto mode = SwitcherMode().Value() == TabSwitcherMode::MostRecentlyUsed ? L"most recently used" : L"in order"; const auto mode = SwitcherMode().Value() == TabSwitcherMode::MostRecentlyUsed ? L"most recently used" : L"in order";
return winrt::hstring(fmt::format(L"{}, {}", RS_(L"PrevTabCommandKey"), mode)); return winrt::hstring(fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"PrevTabCommandKey"), mode));
} }
winrt::hstring NextTabArgs::GenerateName() const winrt::hstring NextTabArgs::GenerateName() const
@ -804,7 +746,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
} }
const auto mode = SwitcherMode().Value() == TabSwitcherMode::MostRecentlyUsed ? L"most recently used" : L"in order"; const auto mode = SwitcherMode().Value() == TabSwitcherMode::MostRecentlyUsed ? L"most recently used" : L"in order";
return winrt::hstring(fmt::format(L"{}, {}", RS_(L"NextTabCommandKey"), mode)); return winrt::hstring(fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"NextTabCommandKey"), mode));
} }
winrt::hstring RenameWindowArgs::GenerateName() const winrt::hstring RenameWindowArgs::GenerateName() const
@ -813,10 +755,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// "Clear window name" // "Clear window name"
if (!Name().empty()) if (!Name().empty())
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"RenameWindowCommandKey", Name()) };
fmt::format(std::wstring_view(RS_(L"RenameWindowCommandKey")),
Name().c_str())
};
} }
return RS_(L"ResetWindowNameCommandKey"); return RS_(L"ResetWindowNameCommandKey");
} }
@ -832,10 +771,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
try try
{ {
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"SearchForTextCommandKey", Windows::Foundation::Uri(QueryUrl()).Domain()) };
fmt::format(std::wstring_view(RS_(L"SearchForTextCommandKey")),
Windows::Foundation::Uri(QueryUrl()).Domain().c_str())
};
} }
CATCH_LOG(); CATCH_LOG();
@ -854,26 +790,22 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return RS_(L"QuakeModeCommandKey"); return RS_(L"QuakeModeCommandKey");
} }
std::wstringstream ss; std::wstring str{ RS_(L"GlobalSummonCommandKey") };
ss << std::wstring_view(RS_(L"GlobalSummonCommandKey"));
// "Summon the Terminal window" // "Summon the Terminal window"
// "Summon the Terminal window, name:\"{_Name}\"" // "Summon the Terminal window, name:\"{_Name}\""
if (!Name().empty()) if (!Name().empty())
{ {
ss << L", name: "; str.append(L", name: ");
ss << std::wstring_view(Name()); str.append(Name());
} }
return winrt::hstring{ ss.str() }; return winrt::hstring{ str };
} }
winrt::hstring FocusPaneArgs::GenerateName() const winrt::hstring FocusPaneArgs::GenerateName() const
{ {
// "Focus pane {Id}" // "Focus pane {Id}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"FocusPaneCommandKey", Id()) };
fmt::format(std::wstring_view(RS_(L"FocusPaneCommandKey")),
Id())
};
} }
winrt::hstring ExportBufferArgs::GenerateName() const winrt::hstring ExportBufferArgs::GenerateName() const
@ -881,10 +813,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (!Path().empty()) if (!Path().empty())
{ {
// "Export text to {path}" // "Export text to {path}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ExportBufferToPathCommandKey", Path()) };
fmt::format(std::wstring_view(RS_(L"ExportBufferToPathCommandKey")),
Path())
};
} }
else else
{ {
@ -924,27 +853,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (Opacity() >= 0) if (Opacity() >= 0)
{ {
// "Increase background opacity by {Opacity}%" // "Increase background opacity by {Opacity}%"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"IncreaseOpacityCommandKey", Opacity()) };
fmt::format(std::wstring_view(RS_(L"IncreaseOpacityCommandKey")),
Opacity())
};
} }
else else
{ {
// "Decrease background opacity by {Opacity}%" // "Decrease background opacity by {Opacity}%"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"DecreaseOpacityCommandKey", Opacity()) };
fmt::format(std::wstring_view(RS_(L"DecreaseOpacityCommandKey")),
Opacity())
};
} }
} }
else else
{ {
// "Set background opacity to {Opacity}%" // "Set background opacity to {Opacity}%"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"AdjustOpacityCommandKey", Opacity()) };
fmt::format(std::wstring_view(RS_(L"AdjustOpacityCommandKey")),
Opacity())
};
} }
} }
@ -952,21 +872,19 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
if (Feature_SaveSnippet::IsEnabled()) if (Feature_SaveSnippet::IsEnabled())
{ {
std::wstringstream ss; auto str = fmt::format(FMT_COMPILE(L"{} commandline: {}"), RS_(L"SaveSnippetNamePrefix"), Commandline());
ss << RS_(L"SaveSnippetNamePrefix").c_str() << L" commandline: " << Commandline().c_str();
if (!Name().empty()) if (!Name().empty())
{ {
ss << L", name: " << Name().c_str(); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L", name: {}"), Name());
} }
if (!KeyChord().empty()) if (!KeyChord().empty())
{ {
ss << L", keyChord " << KeyChord().c_str(); fmt::format_to(std::back_inserter(str), FMT_COMPILE(L", keyChord {}"), KeyChord());
} }
return winrt::hstring{ ss.str() }; return winrt::hstring{ str };
} }
return {}; return {};
} }
@ -1039,7 +957,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
auto matchModeStr = winrt::hstring{}; auto matchModeStr = winrt::hstring{};
if (MatchMode() == Core::MatchMode::All) if (MatchMode() == Core::MatchMode::All)
{ {
matchModeStr = fmt::format(L", {}", RS_(L"ColorSelection_allMatches")); // ", all matches" matchModeStr = fmt::format(FMT_COMPILE(L", {}"), RS_(L"ColorSelection_allMatches")); // ", all matches"
} }
const auto foreground = Foreground(); const auto foreground = Foreground();
@ -1058,31 +976,23 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
if (foreground && backgroundIsBoring) if (foreground && backgroundIsBoring)
{ {
const auto str = RS_(L"ColorSelection_fg_action"); // "Color selection, foreground: {0}{1}" // "Color selection, foreground: {0}{1}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ColorSelection_fg_action", fgStr, matchModeStr) };
fmt::format(std::wstring_view{ str }, fgStr, matchModeStr)
};
} }
else if (background && foregroundIsBoring) else if (background && foregroundIsBoring)
{ {
const auto str = RS_(L"ColorSelection_bg_action"); // "Color selection, background: {0}{1}" // "Color selection, background: {0}{1}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ColorSelection_bg_action", bgStr, matchModeStr) };
fmt::format(std::wstring_view{ str }, bgStr, matchModeStr)
};
} }
else if (foreground && background) else if (foreground && background)
{ {
const auto str = RS_(L"ColorSelection_fg_bg_action"); // "Color selection, foreground: {0}, background: {1}{2}" // "Color selection, foreground: {0}, background: {1}{2}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ColorSelection_fg_bg_action", fgStr, bgStr, matchModeStr) };
fmt::format(std::wstring_view{ str }, fgStr, bgStr, matchModeStr)
};
} }
else else
{ {
const auto str = RS_(L"ColorSelection_default_action"); // "Color selection, (default foreground/background){0}" // "Color selection, (default foreground/background){0}"
return winrt::hstring{ return winrt::hstring{ RS_fmt(L"ColorSelection_default_action", matchModeStr) };
fmt::format(std::wstring_view{ str }, matchModeStr)
};
} }
} }

View File

@ -845,7 +845,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// UI easier. // UI easier.
const auto escapedInput = til::visualize_nonspace_control_codes(std::wstring{ inputString }); const auto escapedInput = til::visualize_nonspace_control_codes(std::wstring{ inputString });
const auto name = fmt::format(std::wstring_view(RS_(L"SendInputCommandKey")), escapedInput); const auto name = RS_fmt(L"SendInputCommandKey", escapedInput);
copy->Name(winrt::hstring{ name }); copy->Name(winrt::hstring{ name });
} }

View File

@ -224,7 +224,7 @@ Model::Profile CascadiaSettings::CreateNewProfile()
for (uint32_t candidateIndex = 0, count = _allProfiles.Size() + 1; candidateIndex < count; candidateIndex++) for (uint32_t candidateIndex = 0, count = _allProfiles.Size() + 1; candidateIndex < count; candidateIndex++)
{ {
// There is a theoretical unsigned integer wraparound, which is OK // There is a theoretical unsigned integer wraparound, which is OK
newName = fmt::format(L"Profile {}", count + candidateIndex); newName = fmt::format(FMT_COMPILE(L"Profile {}"), count + candidateIndex);
if (std::none_of(begin(_allProfiles), end(_allProfiles), [&](auto&& profile) { return profile.Name() == newName; })) if (std::none_of(begin(_allProfiles), end(_allProfiles), [&](auto&& profile) { return profile.Name() == newName; }))
{ {
break; break;
@ -265,7 +265,7 @@ Model::Profile CascadiaSettings::DuplicateProfile(const Model::Profile& source)
{ {
THROW_HR_IF_NULL(E_INVALIDARG, source); THROW_HR_IF_NULL(E_INVALIDARG, source);
auto newName = fmt::format(L"{} ({})", source.Name(), RS_(L"CopySuffix")); auto newName = fmt::format(FMT_COMPILE(L"{} ({})"), source.Name(), RS_(L"CopySuffix"));
// Check if this name already exists and if so, append a number // Check if this name already exists and if so, append a number
for (uint32_t candidateIndex = 0, count = _allProfiles.Size() + 1; candidateIndex < count; ++candidateIndex) for (uint32_t candidateIndex = 0, count = _allProfiles.Size() + 1; candidateIndex < count; ++candidateIndex)
@ -275,7 +275,7 @@ Model::Profile CascadiaSettings::DuplicateProfile(const Model::Profile& source)
break; break;
} }
// There is a theoretical unsigned integer wraparound, which is OK // There is a theoretical unsigned integer wraparound, which is OK
newName = fmt::format(L"{} ({} {})", source.Name(), RS_(L"CopySuffix"), candidateIndex + 2); newName = fmt::format(FMT_COMPILE(L"{} ({} {})"), source.Name(), RS_(L"CopySuffix"), candidateIndex + 2);
} }
const auto duplicated = _createNewProfile(newName); const auto duplicated = _createNewProfile(newName);

View File

@ -556,12 +556,12 @@ void SettingsLoader::_rethrowSerializationExceptionWithLocationInfo(const JsonUt
const auto [line, column] = _lineAndColumnFromPosition(settingsString, static_cast<size_t>(e.jsonValue.getOffsetStart())); const auto [line, column] = _lineAndColumnFromPosition(settingsString, static_cast<size_t>(e.jsonValue.getOffsetStart()));
fmt::memory_buffer msg; fmt::memory_buffer msg;
fmt::format_to(msg, "* Line {}, Column {}", line, column); fmt::format_to(std::back_inserter(msg), "* Line {}, Column {}", line, column);
if (e.key) if (e.key)
{ {
fmt::format_to(msg, " ({})", *e.key); fmt::format_to(std::back_inserter(msg), " ({})", *e.key);
} }
fmt::format_to(msg, "\n Have: {}\n Expected: {}\0", jsonValueAsString, e.expectedType); fmt::format_to(std::back_inserter(msg), "\n Have: {}\n Expected: {}\0", jsonValueAsString, e.expectedType);
throw SettingsTypedDeserializationException{ msg.data() }; throw SettingsTypedDeserializationException{ msg.data() };
} }
@ -1246,7 +1246,7 @@ winrt::hstring CascadiaSettings::_calculateHash(std::string_view settings, const
{ {
const auto fileHash = til::hash(settings); const auto fileHash = til::hash(settings);
const ULARGE_INTEGER fileTime{ lastWriteTime.dwLowDateTime, lastWriteTime.dwHighDateTime }; const ULARGE_INTEGER fileTime{ lastWriteTime.dwLowDateTime, lastWriteTime.dwHighDateTime };
const auto hash = fmt::format(L"{:016x}-{:016x}", fileHash, fileTime.QuadPart); const auto hash = fmt::format(FMT_COMPILE(L"{:016x}-{:016x}"), fileHash, fileTime.QuadPart);
return winrt::hstring{ hash }; return winrt::hstring{ hash };
} }

View File

@ -727,7 +727,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
continue; continue;
} }
auto args = winrt::make_self<SendInputArgs>( auto args = winrt::make_self<SendInputArgs>(
winrt::hstring{ fmt::format(L"{}{}{}", cdText, backspaces, line) }); winrt::hstring{ fmt::format(FMT_COMPILE(L"{}{}{}"), cdText, backspaces, line) });
Model::ActionAndArgs actionAndArgs{ ShortcutAction::SendInput, *args }; Model::ActionAndArgs actionAndArgs{ ShortcutAction::SendInput, *args };

View File

@ -37,9 +37,7 @@ winrt::hstring DefaultTerminal::Version() const
return winrt::hstring{}; return winrt::hstring{};
} }
fmt::wmemory_buffer buffer; return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}.{}.{}.{}"), version.major, version.minor, version.build, version.revision) };
fmt::format_to(buffer, L"{}.{}.{}.{}", version.major, version.minor, version.build, version.revision);
return winrt::hstring{ buffer.data(), gsl::narrow_cast<winrt::hstring::size_type>(buffer.size()) };
} }
winrt::hstring DefaultTerminal::Author() const winrt::hstring DefaultTerminal::Author() const

View File

@ -30,7 +30,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
hstring ToString() hstring ToString()
{ {
return hstring{ fmt::format(L"{}, {}, {}", Name(), Author(), Version()) }; return hstring{ fmt::format(FMT_COMPILE(L"{}, {}, {}"), Name(), Author(), Version()) };
} }
hstring Name() const; hstring Name() const;

View File

@ -69,3 +69,12 @@ namespace Microsoft::Console::Utils
winrt::hstring GetLibraryResourceString(const std::wstring_view key); winrt::hstring GetLibraryResourceString(const std::wstring_view key);
bool HasLibraryResourceWithName(const std::wstring_view key); bool HasLibraryResourceWithName(const std::wstring_view key);
#define RS_fmt(x, ...) RS_fmt_impl(USES_RESOURCE(x), __VA_ARGS__)
template<typename... Args>
std::wstring RS_fmt_impl(std::wstring_view key, Args&&... args)
{
const auto format = GetLibraryResourceString(key);
return fmt::format(fmt::runtime(std::wstring_view{ format }), std::forward<Args>(args)...);
}

View File

@ -109,7 +109,7 @@ _TIL_INLINEPREFIX const std::wstring& GetWtExePath()
// Method Description: // Method Description:
// - Quotes and escapes the given string so that it can be used as a command-line arg. // - Quotes and escapes the given string so that it can be used as a command-line arg.
// - e.g. given `\";foo\` will return `"\\\"\;foo\\"` so that the caller can construct a command-line // - e.g. given `\";foo\` will return `"\\\"\;foo\\"` so that the caller can construct a command-line
// using something such as `fmt::format(L"wt --title {}", QuoteAndQuoteAndEscapeCommandlineArg(TabTitle()))`. // using something such as `fmt::format(FMT_COMPILE(L"wt --title {}"), QuoteAndQuoteAndEscapeCommandlineArg(TabTitle()))`.
// Arguments: // Arguments:
// - arg - the command-line argument to quote and escape. // - arg - the command-line argument to quote and escape.
// Return Value: // Return Value:

View File

@ -239,7 +239,7 @@ void AppHost::_HandleSessionRestore(const bool startedForContent)
// Create new windows for each of the other saved layouts. // Create new windows for each of the other saved layouts.
for (const auto size = layouts.Size(); startIdx < size; startIdx += 1) for (const auto size = layouts.Size(); startIdx < size; startIdx += 1)
{ {
auto newWindowArgs = fmt::format(L"{0} -w new -s {1}", args.Commandline()[0], startIdx); auto newWindowArgs = fmt::format(FMT_COMPILE(L"{} -w new -s {}"), args.Commandline()[0], startIdx);
STARTUPINFO si; STARTUPINFO si;
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));

View File

@ -595,7 +595,7 @@ static winrt::fire_and_forget _createNewTerminalWindow(Settings::Model::GlobalSu
// If we weren't given a name, then just use new to force the window to be // If we weren't given a name, then just use new to force the window to be
// unnamed. // unnamed.
winrt::hstring cmdline{ winrt::hstring cmdline{
fmt::format(L"-w {}", fmt::format(FMT_COMPILE(L"-w {}"),
args.Name().empty() ? L"new" : args.Name().empty() ? L"new" :
args.Name()) args.Name())
}; };

View File

@ -20,7 +20,7 @@ Revision History:
template<> template<>
struct fmt::formatter<winrt::hstring, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t> struct fmt::formatter<winrt::hstring, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t>
{ {
auto format(const winrt::hstring& str, auto& ctx) auto format(const winrt::hstring& str, auto& ctx) const
{ {
return fmt::formatter<fmt::wstring_view, wchar_t>::format({ str.data(), str.size() }, ctx); return fmt::formatter<fmt::wstring_view, wchar_t>::format({ str.data(), str.size() }, ctx);
} }

View File

@ -83,8 +83,11 @@
#include <intsafe.h> #include <intsafe.h>
// {fmt}, a C++20-compatible formatting library // {fmt}, a C++20-compatible formatting library
#include <fmt/format.h> #pragma warning(push)
#pragma warning(disable: 4702) // unreachable code
#include <fmt/compile.h> #include <fmt/compile.h>
#include <fmt/xchar.h>
#pragma warning(pop)
#define USE_INTERVAL_TREE_NAMESPACE #define USE_INTERVAL_TREE_NAMESPACE
#include <IntervalTree.h> #include <IntervalTree.h>

View File

@ -6,16 +6,12 @@
#define NOMINMAX #define NOMINMAX
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <array>
#include <filesystem> #include <filesystem>
#include <functional>
#include <optional> #include <optional>
#include <shared_mutex> #include <shared_mutex>
#include <span> #include <span>
#include <sstream>
#include <string_view> #include <string_view>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector> #include <vector>
#include <d2d1_3.h> #include <d2d1_3.h>
@ -32,9 +28,7 @@
#include <gsl/pointers> #include <gsl/pointers>
#include <wil/com.h> #include <wil/com.h>
#include <wil/filesystem.h> #include <wil/filesystem.h>
#include <wil/result_macros.h>
#include <wil/stl.h> #include <wil/stl.h>
#include <wil/win32_helpers.h>
// Chromium Numerics (safe math) // Chromium Numerics (safe math)
#pragma warning(push) #pragma warning(push)
@ -44,8 +38,10 @@
#pragma warning(pop) #pragma warning(pop)
// {fmt}, a C++20-compatible formatting library // {fmt}, a C++20-compatible formatting library
#include <fmt/format.h> #pragma warning(push)
#pragma warning(disable : 4702) // unreachable code
#include <fmt/compile.h> #include <fmt/compile.h>
#include <fmt/xchar.h>
#pragma warning(pop)
#include <til.h> #include <til.h>
#include <til/bit.h>

View File

@ -28,7 +28,7 @@ namespace Microsoft::Console::VirtualTerminal
return _value; return _value;
} }
constexpr const std::string_view ToString() const constexpr const char* ToString() const
{ {
return &_string[0]; return &_string[0];
} }
@ -693,3 +693,31 @@ namespace Microsoft::Console::VirtualTerminal::DispatchTypes
constexpr VTInt s_sDECCOLMResetColumns = 80; constexpr VTInt s_sDECCOLMResetColumns = 80;
} }
#pragma warning(push)
#pragma warning(disable : 26429) // Symbol 'in' is never tested for nullness, it can be marked as not_null (f.23).
#pragma warning(disable : 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
template<typename Char>
struct fmt::formatter<Microsoft::Console::VirtualTerminal::VTID, Char>
{
constexpr auto parse(auto& ctx)
{
return ctx.begin();
}
constexpr auto format(const Microsoft::Console::VirtualTerminal::VTID& p, auto& ctx) const
{
auto in = p.ToString();
auto out = ctx.out();
for (; *in; ++in, ++out)
{
*out = *in;
}
return out;
}
};
#pragma warning(pop)

View File

@ -4077,7 +4077,7 @@ bool AdaptDispatch::RequestUserPreferenceCharset()
{ {
const auto size = _termOutput.GetUserPreferenceCharsetSize(); const auto size = _termOutput.GetUserPreferenceCharsetSize();
const auto id = _termOutput.GetUserPreferenceCharsetId(); const auto id = _termOutput.GetUserPreferenceCharsetId();
_api.ReturnResponse(fmt::format(FMT_COMPILE(L"\033P{}!u{}\033\\"), (size == 96 ? 1 : 0), id.ToString())); _api.ReturnResponse(fmt::format(FMT_COMPILE(L"\033P{}!u{}\033\\"), (size == 96 ? 1 : 0), id));
return true; return true;
} }
@ -4632,10 +4632,10 @@ void AdaptDispatch::_ReportCursorInformation()
leftSetNumber, leftSetNumber,
rightSetNumber, rightSetNumber,
charsetSizes, charsetSizes,
charset0.ToString(), charset0,
charset1.ToString(), charset1,
charset2.ToString(), charset2,
charset3.ToString()); charset3);
_api.ReturnResponse({ response.data(), response.size() }); _api.ReturnResponse({ response.data(), response.size() });
} }

View File

@ -663,7 +663,7 @@ void UiaTracing::TextProvider::RangeFromPoint(const ScreenInfoUiaProviderBase& s
if (TraceLoggingProviderEnabled(g_UiaProviderTraceProvider, WINEVENT_LEVEL_VERBOSE, TIL_KEYWORD_TRACE)) if (TraceLoggingProviderEnabled(g_UiaProviderTraceProvider, WINEVENT_LEVEL_VERBOSE, TIL_KEYWORD_TRACE))
{ {
static constexpr auto getPoint = [](const UiaPoint& point) { static constexpr auto getPoint = [](const UiaPoint& point) {
return fmt::format(FMT_COMPILE(L"{},{}"), (float)point.x, (float)point.y); return fmt::format(FMT_COMPILE(L"{},{}"), (int)point.x, (int)point.y);
}; };
TraceLoggingWrite( TraceLoggingWrite(

View File

@ -959,7 +959,7 @@ std::tuple<std::wstring, std::wstring> Utils::MangleStartingDirectoryForWSL(std:
break; // just bail out. break; // just bail out.
} }
if (!til::equals_insensitive_ascii(executablePath.parent_path().c_str(), systemDirectory)) if (!til::equals_insensitive_ascii(executablePath.parent_path().native(), systemDirectory))
{ {
break; // it wasn't in system32! break; // it wasn't in system32!
} }

View File

@ -16,7 +16,7 @@
"overrides": [ "overrides": [
{ {
"name": "fmt", "name": "fmt",
"version": "7.1.3" "version": "11.0.2"
}, },
{ {
"name": "ms-gsl", "name": "ms-gsl",
@ -31,5 +31,5 @@
"version": "2.4.2" "version": "2.4.2"
} }
], ],
"builtin-baseline": "2fd62b5d878104f4092af80533923bfe2bba2ee0" "builtin-baseline": "fe1cde61e971d53c9687cf9a46308f8f55da19fa"
} }