Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Compatibility and Terminal page to the Settings UI #17895

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2355,11 +2355,26 @@
"description": "When set to true, the terminal will focus the pane on mouse hover.",
"type": "boolean"
},
"compatibility.allowHeadless": {
"default": false,
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
"type": "boolean"
},
"compatibility.isolatedMode": {
"default": false,
"description": "When set to true, Terminal windows will not be able to interact with each other (including global hotkeys, tab drag/drop, running commandlines in existing windows, etc.). This is a compatibility escape hatch for users who are running into certain windowing issues.",
"type": "boolean"
},
"compatibility.allowVtChecksumReport": {
"default": false,
"description": "When set to true, the terminal will support the DECQRCA escape sequence.",
Fixed Show fixed Hide fixed
"type": "boolean"
},
"compatibility.allowKeypadMode": {
"default": false,
"description": "When set to true, the terminal will support the DECKPAM and DECKPNM escape sequences.",
"type": "boolean"
},
"copyFormatting": {
"default": true,
"description": "When set to `true`, the color and font formatting of selected text is also copied to your clipboard. When set to `false`, only plain text is copied to your clipboard. An array of specific formats can also be used. Supported array values include `html` and `rtf`. Plain text is always copied.",
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalCore/ICoreSettings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ namespace Microsoft.Terminal.Core
String WordDelimiters;

Boolean ForceVTInput;
Boolean AllowVtChecksumReport;
Boolean AllowKeypadMode;
Boolean TrimBlockSelection;
Boolean DetectURLs;

Expand Down
12 changes: 12 additions & 0 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ void Terminal::UpdateSettings(ICoreSettings settings)
_autoMarkPrompts = settings.AutoMarkPrompts();
_rainbowSuggestions = settings.RainbowSuggestions();

if (_stateMachine)
{
SetVtChecksumReportSupport(settings.AllowVtChecksumReport());
}
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved

_getTerminalInput().ForceDisableWin32InputMode(settings.ForceVTInput());
_getTerminalInput().SetKeypadModeSupport(settings.AllowKeypadMode());

if (settings.TabColor() == nullptr)
{
Expand Down Expand Up @@ -215,6 +221,12 @@ void Terminal::EraseScrollback()
engine.Dispatch().EraseInDisplay(DispatchTypes::EraseType::Scrollback);
}

void Terminal::SetVtChecksumReportSupport(const bool enabled)
{
auto& engine = reinterpret_cast<OutputStateMachineEngine&>(_stateMachine->Engine());
engine.Dispatch().SetVtChecksumReportSupport(enabled);
}

bool Terminal::IsXtermBracketedPasteModeEnabled() const noexcept
{
return _systemMode.test(Mode::BracketedPaste);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Microsoft::Terminal::Core::Terminal final :
void SetFontInfo(const FontInfo& fontInfo);
void SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle);
void EraseScrollback();
void SetVtChecksumReportSupport(const bool enabled);
bool IsXtermBracketedPasteModeEnabled() const noexcept;
std::wstring_view GetWorkingDirectory() noexcept;

Expand Down
38 changes: 38 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#include "pch.h"
#include "Compatibility.h"
#include "Compatibility.g.cpp"
#include "CompatibilityViewModel.g.cpp"

using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Microsoft::Terminal::Settings::Model;

namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
CompatibilityViewModel::CompatibilityViewModel(Model::GlobalAppSettings globalSettings) :
_GlobalSettings{ globalSettings }
{
}

bool CompatibilityViewModel::AllowVtChecksumReportAvailable() const noexcept
{
return Feature_VtChecksumReport::IsEnabled();
}

bool CompatibilityViewModel::AllowKeypadModeAvailable() const noexcept
{
return Feature_KeypadModeEnabled::IsEnabled();
}

Compatibility::Compatibility()
{
InitializeComponent();
}

void Compatibility::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>();
}
}
49 changes: 49 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#pragma once

#include "Compatibility.g.h"
#include "CompatibilityViewModel.g.h"
#include "ViewModelHelpers.h"
#include "Utils.h"

namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct CompatibilityViewModel : CompatibilityViewModelT<CompatibilityViewModel>, ViewModelHelper<CompatibilityViewModel>
{
public:
CompatibilityViewModel(Model::GlobalAppSettings globalSettings);

bool AllowVtChecksumReportAvailable() const noexcept;
bool AllowKeypadModeAvailable() const noexcept;

// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
using ViewModelHelper<CompatibilityViewModel>::PropertyChanged;

PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ForceVTInput);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AllowVtChecksumReport);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AllowKeypadMode);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AllowHeadless);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, IsolatedMode);

private:
Model::GlobalAppSettings _GlobalSettings;
};

struct Compatibility : public HasScrollViewer<Compatibility>, CompatibilityT<Compatibility>
{
Compatibility();

void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);

til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(Editor::CompatibilityViewModel, ViewModel, PropertyChanged.raise, nullptr);
};
}

namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
BASIC_FACTORY(Compatibility);
BASIC_FACTORY(CompatibilityViewModel);
}
27 changes: 27 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#include "ViewModelHelpers.idl.h"

namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass CompatibilityViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
CompatibilityViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);

Boolean AllowVtChecksumReportAvailable { get; };
Boolean AllowKeypadModeAvailable { get; };

PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ForceVTInput);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AllowVtChecksumReport);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AllowKeypadMode);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AllowHeadless);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, IsolatedMode);
}

[default_interface] runtimeclass Compatibility : Windows.UI.Xaml.Controls.Page
{
Compatibility();
CompatibilityViewModel ViewModel { get; };
}
}
55 changes: 55 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.Compatibility"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">

<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>

<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Allow Headless -->
<local:SettingContainer x:Uid="Globals_AllowHeadless">
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- Isolated Mode -->
<local:SettingContainer x:Uid="Globals_IsolatedMode">
<ToggleSwitch IsOn="{x:Bind ViewModel.IsolatedMode, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- Force VT Input -->
<local:SettingContainer x:Uid="Globals_ForceVTInput">
<ToggleSwitch IsOn="{x:Bind ViewModel.ForceVTInput, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

<!-- Allow VT Checksum Report -->
<local:SettingContainer x:Uid="Globals_AllowVtChecksumReport">
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowVtChecksumReport, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}"
Visibility="{x:Bind ViewModel.AllowVtChecksumReportAvailable}" />
</local:SettingContainer>

<!-- Allow Keypad Mode -->
<local:SettingContainer x:Uid="Globals_AllowKeypadMode">
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowKeypadMode, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}"
Visibility="{x:Bind ViewModel.AllowKeypadMode}" />
</local:SettingContainer>
</StackPanel>
</Page>
8 changes: 8 additions & 0 deletions src/cascadia/TerminalSettingsEditor/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "MainPage.g.cpp"
#include "Launch.h"
#include "Interaction.h"
#include "Compatibility.h"
#include "Rendering.h"
#include "RenderingViewModel.h"
#include "Actions.h"
Expand Down Expand Up @@ -39,6 +40,7 @@ using namespace winrt::Windows::Foundation::Collections;
static const std::wstring_view launchTag{ L"Launch_Nav" };
static const std::wstring_view interactionTag{ L"Interaction_Nav" };
static const std::wstring_view renderingTag{ L"Rendering_Nav" };
static const std::wstring_view compatibilityTag{ L"Compatibility_Nav" };
static const std::wstring_view actionsTag{ L"Actions_Nav" };
static const std::wstring_view globalProfileTag{ L"GlobalProfile_Nav" };
static const std::wstring_view addProfileTag{ L"AddProfile" };
Expand Down Expand Up @@ -372,6 +374,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Rendering/Content"), BreadcrumbSubPage::None);
_breadcrumbs.Append(crumb);
}
else if (clickedItemTag == compatibilityTag)
{
contentFrame().Navigate(xaml_typename<Editor::Compatibility>(), winrt::make<CompatibilityViewModel>(_settingsClone.GlobalSettings()));
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Compatibility/Content"), BreadcrumbSubPage::None);
_breadcrumbs.Append(crumb);
}
else if (clickedItemTag == actionsTag)
{
contentFrame().Navigate(xaml_typename<Editor::Actions>(), winrt::make<ActionsViewModel>(_settingsClone));
Expand Down
7 changes: 7 additions & 0 deletions src/cascadia/TerminalSettingsEditor/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_Compatibility"
Tag="Compatibility_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEC7A;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_Actions"
Tag="Actions_Nav">
<muxc:NavigationViewItem.Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
<ClInclude Include="Interaction.h">
<DependentUpon>Interaction.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Compatibility.h">
<DependentUpon>Compatibility.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="KeyChordListener.h">
<DependentUpon>KeyChordListener.xaml</DependentUpon>
</ClInclude>
Expand Down Expand Up @@ -154,6 +157,9 @@
<Page Include="Interaction.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="Compatibility.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="KeyChordListener.xaml">
<SubType>Designer</SubType>
</Page>
Expand Down Expand Up @@ -204,6 +210,9 @@
<ClCompile Include="Interaction.cpp">
<DependentUpon>Interaction.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Compatibility.cpp">
<DependentUpon>Compatibility.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="KeyChordListener.cpp">
<DependentUpon>KeyChordListener.xaml</DependentUpon>
</ClCompile>
Expand Down Expand Up @@ -311,6 +320,10 @@
<DependentUpon>Interaction.xaml</DependentUpon>
<SubType>Code</SubType>
</Midl>
<Midl Include="Compatibility.idl">
<DependentUpon>Compatibility.xaml</DependentUpon>
<SubType>Code</SubType>
</Midl>
<Midl Include="Rendering.idl">
<DependentUpon>Rendering.xaml</DependentUpon>
<SubType>Code</SubType>
Expand Down
44 changes: 44 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,50 @@
<value>Always on top</value>
<comment>Header for a control to toggle if the app will always be presented on top of other windows, or is treated normally (when disabled).</comment>
</data>
<data name="Globals_ForceVTInput.Header" xml:space="preserve">
<value>Force the terminal to use the legacy input encoding</value>
<comment>Header for a control to toggle legacy input encoding for the terminal.</comment>
</data>
<data name="Globals_AllowVtChecksumReport.Header" xml:space="preserve">
<value>Allow VT checksum report</value>
<comment>Header for a control to toggle support for a virtual terminal (VT) sequence that reports a checksum of a portion of the terminal buffer.</comment>
</data>
<data name="Globals_AllowKeypadMode.Header" xml:space="preserve">
<value>Allow keypad mode</value>
<comment>Header for a control to toggle support for VT keypad modes.</comment>
</data>
<data name="Globals_AllowHeadless.Header" xml:space="preserve">
<value>Allow Windows Terminal to run in the background</value>
<comment>Header for a control to toggle support for Windows Terminal to run in the background.</comment>
</data>
<data name="Globals_IsolatedMode.Header" xml:space="preserve">
<value>Force each window to be its own process</value>
<comment>Header for a control to toggle making each window be its own process.</comment>
</data>
<data name="Globals_AlwaysOnTop.HelpText" xml:space="preserve">
<value>Terminal will always be the topmost window on the desktop.</value>
<comment>A description for what the "always on top" setting does. Presented near "Globals_AlwaysOnTop.Header".</comment>
</data>
<data name="Globals_ForceVTInput.HelpText" xml:space="preserve">
<value>Certain keys in some applications may stop working when enabling this setting.</value>
<comment>Additional description for what the "force vt input" setting does. Presented near "Globals_ForceVTInput.Header".</comment>
</data>
<data name="Globals_AllowVtChecksumReport.HelpText" xml:space="preserve">
<value>Enables support for the DECRQRCA escape sequence</value>
Fixed Show fixed Hide fixed
<comment>Additional description for what the "allow vt checksum report" setting does. Presented near "Globals_AllowVtChecksumReport.Header".</comment>
</data>
<data name="Globals_AllowKeypadMode.HelpText" xml:space="preserve">
<value>Enables support for the DECKPAM and DECKPNM escape sequences to work as intended</value>
<comment>Additional description for what the "allow keypad mode" setting does. Presented near "Globals_AllowKeypadMode.Header".</comment>
</data>
<data name="Globals_AllowHeadless.HelpText" xml:space="preserve">
<value>This allows Global Summon and Quake Mode actions to work even when no windows are open.</value>
<comment>Additional description for what the "allow headless" setting does. Presented near "Globals_AllowHeadless.Header".</comment>
</data>
<data name="Globals_IsolatedMode.HelpText" xml:space="preserve">
<value>Certain features including but not limited to global hotkeys, tab drag and drop, and running commandlines in existing windows won't work.</value>
<comment>Additional description for what the "isolated mode" setting does. Presented near "Globals_IsolatedMode.Header".</comment>
</data>
<data name="Globals_TabWidthMode.Header" xml:space="preserve">
<value>Tab width mode</value>
<comment>Header for a control to choose how wide the tabs are.</comment>
Expand Down Expand Up @@ -611,6 +651,10 @@
<value>Interaction</value>
<comment>Header for the "interaction" menu item. This navigates to a page that lets you see and modify settings related to the user's mouse and touch interactions with the app.</comment>
</data>
<data name="Nav_Compatibility.Content" xml:space="preserve">
<value>Compatibility</value>
<comment>Header for the "compatibility" menu item. This navigates to a page that lets you see and modify settings related to compatibility with command line scenarios.</comment>
</data>
<data name="Nav_Launch.Content" xml:space="preserve">
<value>Startup</value>
<comment>Header for the "startup" menu item. This navigates to a page that lets you see and modify settings related to the app's launch experience (i.e. screen position, mode, etc.)</comment>
Expand Down
Loading
Loading