diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.cpp b/src/cascadia/TerminalSettingsEditor/Appearances.cpp index 3fcbfb58a2c..5a1603a4200 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.cpp +++ b/src/cascadia/TerminalSettingsEditor/Appearances.cpp @@ -573,11 +573,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation } } - double AppearanceViewModel::LineHeight() const + double AppearanceViewModel::_extractCellSizeValue(const hstring val) const { - const auto fontInfo = _appearance.SourceProfile().FontInfo(); - const auto cellHeight = fontInfo.CellHeight(); - const auto str = cellHeight.c_str(); + const auto str = val.c_str(); auto& errnoRef = errno; // Nonzero cost, pay it once. errnoRef = 0; @@ -588,29 +586,49 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation return str == end || errnoRef == ERANGE ? NAN : value; } - void AppearanceViewModel::LineHeight(const double value) + double AppearanceViewModel::LineHeight() const { - std::wstring str; + const auto cellHeight = _appearance.SourceProfile().FontInfo().CellHeight(); + return _extractCellSizeValue(cellHeight); + } - if (value >= 0.1 && value <= 10.0) - { - str = fmt::format(FMT_STRING(L"{:.6g}"), value); - } + double AppearanceViewModel::CellWidth() const + { + const auto cellWidth = _appearance.SourceProfile().FontInfo().CellHeight(); + return _extractCellSizeValue(cellWidth); + } - const auto fontInfo = _appearance.SourceProfile().FontInfo(); +#define CELL_SIZE_SETTER(modelName, viewModelName) \ + std::wstring str; \ + \ + if (value >= 0.1 && value <= 10.0) \ + { \ + str = fmt::format(FMT_STRING(L"{:.6g}"), value); \ + } \ + \ + const auto fontInfo = _appearance.SourceProfile().FontInfo(); \ + \ + if (fontInfo.modelName() != str) \ + { \ + if (str.empty()) \ + { \ + fontInfo.Clear##modelName(); \ + } \ + else \ + { \ + fontInfo.modelName(str); \ + } \ + _NotifyChanges(L"Has" #viewModelName, L## #viewModelName); \ + } - if (fontInfo.CellHeight() != str) - { - if (str.empty()) - { - fontInfo.ClearCellHeight(); - } - else - { - fontInfo.CellHeight(str); - } - _NotifyChanges(L"HasLineHeight", L"LineHeight"); - } + void AppearanceViewModel::LineHeight(const double value) + { + CELL_SIZE_SETTER(CellHeight, LineHeight); + } + + void AppearanceViewModel::CellWidth(const double value) + { + CELL_SIZE_SETTER(CellWidth, CellWidth); } bool AppearanceViewModel::HasLineHeight() const @@ -619,17 +637,34 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation return fontInfo.HasCellHeight(); } + bool AppearanceViewModel::HasCellWidth() const + { + const auto fontInfo = _appearance.SourceProfile().FontInfo(); + return fontInfo.HasCellWidth(); + } + void AppearanceViewModel::ClearLineHeight() { LineHeight(NAN); } + void AppearanceViewModel::ClearCellWidth() + { + CellWidth(NAN); + } + Model::FontConfig AppearanceViewModel::LineHeightOverrideSource() const { const auto fontInfo = _appearance.SourceProfile().FontInfo(); return fontInfo.CellHeightOverrideSource(); } + Model::FontConfig AppearanceViewModel::CellWidthOverrideSource() const + { + const auto fontInfo = _appearance.SourceProfile().FontInfo(); + return fontInfo.CellWidthOverrideSource(); + } + void AppearanceViewModel::SetFontWeightFromDouble(double fontWeight) { FontWeight(winrt::Microsoft::Terminal::UI::Converters::DoubleToFontWeight(fontWeight)); diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.h b/src/cascadia/TerminalSettingsEditor/Appearances.h index 27a58073a8f..2831a3a9408 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.h +++ b/src/cascadia/TerminalSettingsEditor/Appearances.h @@ -92,6 +92,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation void ClearLineHeight(); Model::FontConfig LineHeightOverrideSource() const; + double CellWidth() const; + void CellWidth(const double value); + bool HasCellWidth() const; + void ClearCellWidth(); + Model::FontConfig CellWidthOverrideSource() const; + void SetFontWeightFromDouble(double fontWeight); const FontFaceDependentsData& FontFaceDependents(); @@ -161,6 +167,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation void _deleteAllFontKeyValuePairs(FontSettingIndex index); void _addMenuFlyoutItemToUnused(FontSettingIndex index, Windows::UI::Xaml::Controls::MenuFlyoutItemBase item); + double _extractCellSizeValue(const hstring val) const; + Model::AppearanceConfig _appearance; winrt::hstring _lastBgImagePath; std::optional _fontFaceDependents; diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.idl b/src/cascadia/TerminalSettingsEditor/Appearances.idl index 0907e5f8f3d..5a22a190d2d 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.idl +++ b/src/cascadia/TerminalSettingsEditor/Appearances.idl @@ -62,6 +62,7 @@ namespace Microsoft.Terminal.Settings.Editor OBSERVABLE_PROJECTED_APPEARANCE_SETTING(String, FontFace); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Single, FontSize); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Double, LineHeight); + OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Double, CellWidth); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.UI.Text.FontWeight, FontWeight); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Boolean, EnableBuiltinGlyphs); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Boolean, EnableColorGlyphs); diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.xaml b/src/cascadia/TerminalSettingsEditor/Appearances.xaml index a3f643c53c3..0ad7674c120 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.xaml +++ b/src/cascadia/TerminalSettingsEditor/Appearances.xaml @@ -264,6 +264,22 @@ Value="{x:Bind Appearance.LineHeight, Mode=TwoWay}" /> + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.h b/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.h index e71a034de95..538c59a430c 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.h +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.h @@ -49,6 +49,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AutoHideWindow); PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowNotificationIcon); PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, MinimizeToNotificationArea); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowAdminShield); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableUnfocusedAcrylic); private: Model::GlobalAppSettings _GlobalSettings; diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.idl b/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.idl index 8dd700edc3d..6b49376c71b 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.idl +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearanceViewModel.idl @@ -38,5 +38,7 @@ namespace Microsoft.Terminal.Settings.Editor PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AutoHideWindow); PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AlwaysShowNotificationIcon); PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, MinimizeToNotificationArea); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ShowAdminShield); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, EnableUnfocusedAcrylic); } } diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.xaml b/src/cascadia/TerminalSettingsEditor/Interaction.xaml index d682aaf64b3..ebf56c37589 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.xaml +++ b/src/cascadia/TerminalSettingsEditor/Interaction.xaml @@ -88,9 +88,25 @@ Style="{StaticResource ToggleSwitchInExpanderStyle}" /> + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/InteractionViewModel.h b/src/cascadia/TerminalSettingsEditor/InteractionViewModel.h index e6bcbd2b2e9..61ccc8f1d77 100644 --- a/src/cascadia/TerminalSettingsEditor/InteractionViewModel.h +++ b/src/cascadia/TerminalSettingsEditor/InteractionViewModel.h @@ -26,8 +26,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize); PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse); PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl); PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters); PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ConfirmCloseAllTabs); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableColorSelection); private: Model::GlobalAppSettings _GlobalSettings; diff --git a/src/cascadia/TerminalSettingsEditor/InteractionViewModel.idl b/src/cascadia/TerminalSettingsEditor/InteractionViewModel.idl index ddd87501850..e4f1de7b2e9 100644 --- a/src/cascadia/TerminalSettingsEditor/InteractionViewModel.idl +++ b/src/cascadia/TerminalSettingsEditor/InteractionViewModel.idl @@ -23,7 +23,9 @@ namespace Microsoft.Terminal.Settings.Editor PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, SnapToGridOnResize); PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, FocusFollowMouse); PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DetectURLs); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, SearchWebDefaultQueryUrl); PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, WordDelimiters); PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ConfirmCloseAllTabs); + PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, EnableColorSelection); } } diff --git a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h index f0ce84f1f05..c25d448b54c 100644 --- a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h +++ b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h @@ -120,6 +120,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation OBSERVABLE_PROJECTED_SETTING(_profile, ShowMarks); OBSERVABLE_PROJECTED_SETTING(_profile, AutoMarkPrompts); OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse); + OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions); + OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage); WINRT_PROPERTY(bool, IsBaseLayer, false); WINRT_PROPERTY(bool, FocusDeleteButton, false); diff --git a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl index c0bc407c7ae..302eed530e6 100644 --- a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl +++ b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl @@ -111,5 +111,7 @@ namespace Microsoft.Terminal.Settings.Editor OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, ShowMarks); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AutoMarkPrompts); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RepositionCursorWithMouse); + OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions); + OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage); } } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles_Advanced.xaml b/src/cascadia/TerminalSettingsEditor/Profiles_Advanced.xaml index add8fb2cf77..c9cda0db6ea 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles_Advanced.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles_Advanced.xaml @@ -165,6 +165,25 @@ Style="{StaticResource ToggleSwitchInExpanderStyle}" /> + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index cffae127f5a..fb7e3963cc1 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -281,6 +281,14 @@ Automatically detect URLs and make them clickable Header for a control to toggle whether the terminal should automatically detect URLs and make them clickable, or not. + + Query URL for "Search web" action + Header for a control to set the query URL when using the "search web" action. + + + "%s" is replaced with the selected text. + {Locked="%s"} Additional text presented near "Globals_SearchWebDefaultQueryUrl.Header". + Remove trailing white-space in rectangular selection Header for a control to toggle whether a text selected with block selection should be trimmed of white spaces when copied to the clipboard, or not. @@ -932,18 +940,34 @@ Line height Header for a control that sets the text line height. + + Cell width + Header for a control that sets the text character width. + Line height Header for a control that sets the text line height. + + Cell width + Header for a control that sets the text character width. + Override the line height of the terminal. Measured as a multiple of the font size. The default value depends on your font and is usually around 1.2. A description for what the "line height" setting does. Presented near "Profile_LineHeight". + + Override the cell width of the terminal. Measured as a multiple of the font size. The default value depends on your font and is usually around 1.2. + A description for what the "cell width" setting does. Presented near "Profile_CellWidth". + 1.2 "1.2" is a decimal number. + + 1.2 + "1.2" is a decimal number. + Builtin Glyphs The main label of a toggle. When enabled, certain characters (glyphs) are replaced with better looking ones. @@ -1156,10 +1180,18 @@ Tab title Header for a control to determine the title of the tab. This is represented using a text box. + + ENQ response + {Locked=ENQ} Header for a control to determine the response to the ENQ escape sequence. This is represented using a text box. + Replaces the profile name as the title to pass to the shell on startup. A description for what the "tab title" setting does. Presented near "Profile_TabTitle". + + The response that is sent when an ENQ control character is received. + {Locked=ENQ} A description for what the "tab title" setting does. Presented near "Profile_TabTitle". + Unfocused appearance The header for the section where the unfocused appearance settings can be changed. @@ -1839,4 +1871,20 @@ Non-monospace fonts: This is a label that is followed by a list of proportional fonts. + + Display suggestions UI preview text with rainbow formatting + This is a label for a setting that, when enabled, applies a rainbow coloring to the preview text from the suggestions UI. + + + Experimental: Add key bindings to color selected text + Header for a control to toggle adding a set of key bindings that can be used to apply coloring to selected text in a terminal session. + + + Allow acrylic background in unfocused windows + Header for a control to toggle allowing unfocused windows to have an acrylic background. + + + Display a shield in the title bar for sessions as Admin + Header for a control to toggle displaying a shield in the title bar of the app. "Admin" refers to elevated sessions like "run as Admin" + \ No newline at end of file diff --git a/src/cascadia/TerminalSettingsModel/MTSMSettings.h b/src/cascadia/TerminalSettingsModel/MTSMSettings.h index 85e091077a8..e33ab27866c 100644 --- a/src/cascadia/TerminalSettingsModel/MTSMSettings.h +++ b/src/cascadia/TerminalSettingsModel/MTSMSettings.h @@ -92,14 +92,14 @@ Author(s): X(hstring, TabTitle, "tabTitle") \ X(Model::BellStyle, BellStyle, "bellStyle", BellStyle::Audible) \ X(IEnvironmentVariableMap, EnvironmentVariables, "environment", nullptr) \ - X(bool, RightClickContextMenu, "experimental.rightClickContextMenu", false) \ + X(bool, RightClickContextMenu, "rightClickContextMenu", false) \ X(Windows::Foundation::Collections::IVector, BellSound, "bellSound", nullptr) \ X(bool, Elevate, "elevate", false) \ X(bool, AutoMarkPrompts, "autoMarkPrompts", true) \ X(bool, ShowMarks, "showMarksOnScrollbar", false) \ X(bool, RepositionCursorWithMouse, "experimental.repositionCursorWithMouse", false) \ X(bool, ReloadEnvironmentVariables, "compatibility.reloadEnvironmentVariables", true) \ - X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) + X(bool, RainbowSuggestions, "rainbowSuggestions", false) // Intentionally omitted Profile settings: // * Name diff --git a/src/cascadia/TerminalSettingsModel/Profile.cpp b/src/cascadia/TerminalSettingsModel/Profile.cpp index 3d1d2782472..b8a3f931f5c 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.cpp +++ b/src/cascadia/TerminalSettingsModel/Profile.cpp @@ -36,6 +36,8 @@ static constexpr std::string_view UnfocusedAppearanceKey{ "unfocusedAppearance" static constexpr std::string_view LegacyAutoMarkPromptsKey{ "experimental.autoMarkPrompts" }; static constexpr std::string_view LegacyShowMarksKey{ "experimental.showMarksOnScrollbar" }; +static constexpr std::string_view LegacyRightClickContextMenuKey{ "experimental.rightClickContextMenu" }; +static constexpr std::string_view LegacyRainbowSuggestionsKey{ "experimental.rainbowSuggestions" }; Profile::Profile(guid guid) noexcept : _Guid(guid) @@ -196,6 +198,8 @@ void Profile::LayerJson(const Json::Value& json) // Done _before_ the MTSM_PROFILE_SETTINGS, which have the updated keys. JsonUtils::GetValueForKey(json, LegacyShowMarksKey, _ShowMarks); JsonUtils::GetValueForKey(json, LegacyAutoMarkPromptsKey, _AutoMarkPrompts); + JsonUtils::GetValueForKey(json, LegacyRightClickContextMenuKey, _RightClickContextMenu); + JsonUtils::GetValueForKey(json, LegacyRainbowSuggestionsKey, _RainbowSuggestions); #define PROFILE_SETTINGS_LAYER_JSON(type, name, jsonKey, ...) \ JsonUtils::GetValueForKey(json, jsonKey, _##name); \