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

Merged
merged 25 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8a34341
Add a Compatibility page to the Settings UI
carlos-zamora Sep 9, 2024
b7569e0
experimental.input.forceVT -> compatibility.input.forceVT
carlos-zamora Sep 9, 2024
b153672
Add compatibility.allowVtChecksumReport global setting
carlos-zamora Sep 10, 2024
d609f14
Add compatibility.allowKeypadMode global setting
carlos-zamora Sep 10, 2024
47cd42d
Add a few more compatibility settings to SUI
carlos-zamora Sep 10, 2024
60ac05f
update schema
carlos-zamora Sep 10, 2024
44f0e79
fix build
carlos-zamora Sep 10, 2024
92b0bf1
spell
carlos-zamora Sep 10, 2024
1dc0714
audit mode
carlos-zamora Sep 11, 2024
55533d1
fix tests
carlos-zamora Sep 12, 2024
7123a37
move 'textMeasurement' to compat page
carlos-zamora Sep 12, 2024
302e072
remove feature flag
carlos-zamora Sep 12, 2024
90d8fa1
add debugFeatures too
carlos-zamora Sep 12, 2024
bc84a4c
apply feedback; create Profile>Terminal page
carlos-zamora Sep 24, 2024
cb661bc
apply feedback
carlos-zamora Sep 24, 2024
bb1521b
missed one
carlos-zamora Sep 24, 2024
c694620
update schema
carlos-zamora Sep 24, 2024
053477d
Merge branch 'main' into dev/cazamor/sui/compatibility-0age
carlos-zamora Sep 24, 2024
a47a703
whoops
carlos-zamora Sep 24, 2024
62fbfc8
Merge branch 'main' into dev/cazamor/sui/compatibility-0age
carlos-zamora Sep 25, 2024
fcdaa17
fix test; add AnswerbackMessage setting
carlos-zamora Sep 25, 2024
64454b4
remove DECKPAM setting; fix bad merge
carlos-zamora Sep 25, 2024
89e3ba9
Merge branch 'main' into dev/cazamor/sui/compatibility-0age
carlos-zamora Oct 10, 2024
256a711
apply feedback
carlos-zamora Oct 10, 2024
b0952b8
Merge branch 'main' into dev/cazamor/sui/compatibility-0age
carlos-zamora Oct 10, 2024
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
10 changes: 10 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2355,11 +2355,21 @@
"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.allowDECRQCRA": {
"default": false,
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
"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
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/ICoreSettings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Microsoft.Terminal.Core
String WordDelimiters;

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

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

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

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

if (settings.TabColor() == nullptr)
Expand Down Expand Up @@ -212,6 +217,12 @@ void Terminal::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
engine.Dispatch().SetCursorStyle(cursorStyle);
}

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 @@ -94,6 +94,7 @@ class Microsoft::Terminal::Core::Terminal final :
void UpdateAppearance(const winrt::Microsoft::Terminal::Core::ICoreAppearance& appearance);
void SetFontInfo(const FontInfo& fontInfo);
void SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle);
void SetVtChecksumReportSupport(const bool enabled);
bool IsXtermBracketedPasteModeEnabled() const noexcept;
std::wstring_view GetWorkingDirectory() noexcept;

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

#include "pch.h"
#include "Compatibility.h"
#include "EnumEntry.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 }
{
INITIALIZE_BINDABLE_ENUM_SETTING(TextMeasurement, TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, L"Globals_TextMeasurement_", L"Text");
}

bool CompatibilityViewModel::DebugFeaturesAvailable() const noexcept
{
return Feature_DebugModeUI::IsEnabled();
}

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

void Compatibility::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>();
}
}
47 changes: 47 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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 DebugFeaturesAvailable() 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, AllowHeadless);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, IsolatedMode);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DebugFeaturesEnabled);
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _GlobalSettings.TextMeasurement);

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);
}
29 changes: 29 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import "EnumEntry.idl";

#include "ViewModelHelpers.idl.h"

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

Boolean DebugFeaturesAvailable { get; };

PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AllowHeadless);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, IsolatedMode);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DebugFeaturesEnabled);

IInspectable CurrentTextMeasurement;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TextMeasurementList { get; };
}

[default_interface] runtimeclass Compatibility : Windows.UI.Xaml.Controls.Page
{
Compatibility();
CompatibilityViewModel ViewModel { get; };
}
}
56 changes: 56 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Compatibility.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--
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>

<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<TextBlock Text="{x:Bind EnumName}" />
</DataTemplate>
</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>

<!-- Text Measurement -->
<local:SettingContainer x:Uid="Globals_TextMeasurement">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TextMeasurementList}"
SelectedItem="{x:Bind ViewModel.CurrentTextMeasurement, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>

<!-- Debug Features -->
<local:SettingContainer x:Uid="Globals_DebugFeaturesEnabled"
Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}">
<ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</Page>
23 changes: 23 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 @@ -339,6 +341,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_breadcrumbs.Append(crumb);
SettingsMainPage_ScrollViewer().ScrollToVerticalOffset(0);
}
else if (currentPage == ProfileSubPage::Terminal)
{
contentFrame().Navigate(xaml_typename<Editor::Profiles_Terminal>(), profile);
const auto crumb = winrt::make<Breadcrumb>(breadcrumbTag, RS_(L"Profile_Terminal/Header"), BreadcrumbSubPage::Profile_Terminal);
_breadcrumbs.Append(crumb);
SettingsMainPage_ScrollViewer().ScrollToVerticalOffset(0);
}
else if (currentPage == ProfileSubPage::Advanced)
{
contentFrame().Navigate(xaml_typename<Editor::Profiles_Advanced>(), profile);
Expand Down Expand Up @@ -372,6 +381,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 All @@ -395,6 +410,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
profileVM.CurrentPage(ProfileSubPage::Appearance);
}
else if (subPage == BreadcrumbSubPage::Profile_Terminal)
{
profileVM.CurrentPage(ProfileSubPage::Terminal);
}
else if (subPage == BreadcrumbSubPage::Profile_Advanced)
{
profileVM.CurrentPage(ProfileSubPage::Advanced);
Expand Down Expand Up @@ -452,6 +471,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
profile.CurrentPage(ProfileSubPage::Appearance);
}
else if (subPage == BreadcrumbSubPage::Profile_Terminal)
{
profile.CurrentPage(ProfileSubPage::Terminal);
}
else if (subPage == BreadcrumbSubPage::Profile_Advanced)
{
profile.CurrentPage(ProfileSubPage::Advanced);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsEditor/MainPage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Microsoft.Terminal.Settings.Editor
{
None = 0,
Profile_Appearance,
Profile_Terminal,
Profile_Advanced,
ColorSchemes_Edit
};
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
Loading
Loading