diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index e9f123f7007..b4ab5a64065 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -2373,11 +2373,6 @@ "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.allowDECRQCRA": { - "default": false, - "description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.", - "type": "boolean" - }, "compatibility.textMeasurement": { "default": "graphemes", "description": "This changes the way incoming text is grouped into cells. The \"graphemes\" option is the most modern and Unicode-correct way to do so, while \"wcswidth\" is a common approach on UNIX, and \"console\" replicates the way it used to work on Windows.", @@ -2726,6 +2721,16 @@ "description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.", "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" + }, + "compatibility.allowOSC52": { + "default": true, + "description": "When set to true, VT applications will be allowed to set the contents of the local clipboard using OSC 52 (Manipulate Selection Data).", + "type": "boolean" + }, "unfocusedAppearance": { "$ref": "#/$defs/AppearanceConfig", "description": "Sets the appearance of the terminal when it is unfocused.", diff --git a/src/cascadia/TerminalCore/ICoreSettings.idl b/src/cascadia/TerminalCore/ICoreSettings.idl index ff6588c2ead..804b4f46874 100644 --- a/src/cascadia/TerminalCore/ICoreSettings.idl +++ b/src/cascadia/TerminalCore/ICoreSettings.idl @@ -22,6 +22,7 @@ namespace Microsoft.Terminal.Core Boolean ForceVTInput; Boolean AllowVtChecksumReport; + Boolean AllowVtClipboardWrite; Boolean TrimBlockSelection; Boolean DetectURLs; diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index c77ab1ab764..67a1523e99b 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -89,6 +89,7 @@ void Terminal::UpdateSettings(ICoreSettings settings) _trimBlockSelection = settings.TrimBlockSelection(); _autoMarkPrompts = settings.AutoMarkPrompts(); _rainbowSuggestions = settings.RainbowSuggestions(); + _clipboardOperationsAllowed = settings.AllowVtClipboardWrite(); if (_stateMachine) { diff --git a/src/cascadia/TerminalCore/Terminal.hpp b/src/cascadia/TerminalCore/Terminal.hpp index 8ac499c97e2..0ff2cb1955e 100644 --- a/src/cascadia/TerminalCore/Terminal.hpp +++ b/src/cascadia/TerminalCore/Terminal.hpp @@ -413,6 +413,7 @@ class Microsoft::Terminal::Core::Terminal final : Microsoft::Console::Types::Viewport _mutableViewport; til::CoordType _scrollbackLines = 0; bool _detectURLs = false; + bool _clipboardOperationsAllowed = true; til::size _altBufferSize; std::optional _deferredResize; diff --git a/src/cascadia/TerminalCore/TerminalApi.cpp b/src/cascadia/TerminalCore/TerminalApi.cpp index e6edec3ee92..7d8a7062740 100644 --- a/src/cascadia/TerminalCore/TerminalApi.cpp +++ b/src/cascadia/TerminalCore/TerminalApi.cpp @@ -140,7 +140,10 @@ unsigned int Terminal::GetInputCodePage() const noexcept void Terminal::CopyToClipboard(wil::zwstring_view content) { - _pfnCopyToClipboard(content); + if (_clipboardOperationsAllowed) + { + _pfnCopyToClipboard(content); + } } // Method Description: diff --git a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h index 4b70acaacc2..9d425bb94b9 100644 --- a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h +++ b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h @@ -153,6 +153,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse); OBSERVABLE_PROJECTED_SETTING(_profile, ForceVTInput); OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport); + OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtClipboardWrite); OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage); OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions); OBSERVABLE_PROJECTED_SETTING(_profile, PathTranslationStyle); diff --git a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl index 0b58480053a..89490cbd57d 100644 --- a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl +++ b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl @@ -155,5 +155,6 @@ namespace Microsoft.Terminal.Settings.Editor OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions); OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle); + OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtClipboardWrite); } } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml b/src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml index fd0111bcd7d..b568aebbaae 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml @@ -60,6 +60,15 @@ Style="{StaticResource ToggleSwitchInExpanderStyle}" /> + + + + + Allow DECRQCRA (Request Checksum of Rectangular Area) {Locked="DECRQCRA"}{Locked="Request Checksum of Rectangular Area"}Header for a control to toggle support for the DECRQCRA control sequence. + + Allow OSC 52 (Manipulate Selection Data) to write to the clipboard + {Locked="OSC 52"}{Locked="Manipulate Selection Data"}Header for a control to toggle support for applications to change the contents of the Windows system clipboard. + Allow Windows Terminal to run in the background Header for a control to toggle support for Windows Terminal to run in the background. diff --git a/src/cascadia/TerminalSettingsModel/MTSMSettings.h b/src/cascadia/TerminalSettingsModel/MTSMSettings.h index c2553db2e47..2faa985c5ea 100644 --- a/src/cascadia/TerminalSettingsModel/MTSMSettings.h +++ b/src/cascadia/TerminalSettingsModel/MTSMSettings.h @@ -101,6 +101,7 @@ Author(s): X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \ X(bool, ForceVTInput, "compatibility.input.forceVT", false) \ X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \ + X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \ X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \ X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None) diff --git a/src/cascadia/TerminalSettingsModel/Profile.idl b/src/cascadia/TerminalSettingsModel/Profile.idl index 4c927aa08d6..0d1ffe9f364 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.idl +++ b/src/cascadia/TerminalSettingsModel/Profile.idl @@ -94,6 +94,7 @@ namespace Microsoft.Terminal.Settings.Model INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput); INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport); INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode); + INHERITABLE_PROFILE_SETTING(Boolean, AllowVtClipboardWrite); INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle); } diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp index a5944e9cdc7..ff9860aef6b 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp @@ -348,6 +348,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation _RainbowSuggestions = profile.RainbowSuggestions(); _ForceVTInput = profile.ForceVTInput(); _AllowVtChecksumReport = profile.AllowVtChecksumReport(); + _AllowVtClipboardWrite = profile.AllowVtClipboardWrite(); _PathTranslationStyle = profile.PathTranslationStyle(); } diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.h b/src/cascadia/TerminalSettingsModel/TerminalSettings.h index e7cd26d7f4e..9591ad34875 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.h @@ -97,6 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtChecksumReport, false); INHERITABLE_SETTING(Model::TerminalSettings, bool, TrimBlockSelection, true); INHERITABLE_SETTING(Model::TerminalSettings, bool, DetectURLs, true); + INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtClipboardWrite, true); INHERITABLE_SETTING(Model::TerminalSettings, Windows::Foundation::IReference, TabColor, nullptr); diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index 671d2de8012..42c3b1b9d30 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -52,7 +52,8 @@ X(bool, AutoMarkPrompts) \ X(bool, RepositionCursorWithMouse, false) \ X(bool, RainbowSuggestions) \ - X(bool, AllowVtChecksumReport) + X(bool, AllowVtChecksumReport) \ + X(bool, AllowVtClipboardWrite) // --------------------------- Control Settings --------------------------- // All of these settings are defined in IControlSettings.