diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 47a9b0615b..cce85bddcc 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -874,7 +874,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation // _cursorTimer doesn't exist, and it would never turn on the // cursor. To mitigate, we'll initialize the cursor's 'on' state // with `_focused` here. - _core.CursorOn(_focused); + _core.CursorOn(_focused || DisplayCursorWhileBlurred); + if (DisplayCursorWhileBlurred) + { + _cursorTimer->Start(); + } } else { @@ -1749,7 +1753,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation TSFInputControl().NotifyFocusLeave(); } - if (_cursorTimer) + if (_cursorTimer && !DisplayCursorWhileBlurred) { _cursorTimer->Stop(); _core.CursorOn(false); diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 08498ab301..d6037c7209 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -165,6 +165,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, BackgroundBrush, _PropertyChangedHandlers, nullptr); + public: + til::property DisplayCursorWhileBlurred{ false }; + private: friend struct TermControlT; // friend our parent so it can bind private event handlers diff --git a/src/cascadia/TerminalControl/TermControl.idl b/src/cascadia/TerminalControl/TermControl.idl index d4b91dd685..2f48433400 100644 --- a/src/cascadia/TerminalControl/TermControl.idl +++ b/src/cascadia/TerminalControl/TermControl.idl @@ -98,6 +98,8 @@ namespace Microsoft.Terminal.Control // opacity set by the settings should call this instead. Double BackgroundOpacity { get; }; + Boolean DisplayCursorWhileBlurred; + Windows.UI.Xaml.Media.Brush BackgroundBrush { get; }; void ColorSelection(SelectionColor fg, SelectionColor bg, Microsoft.Terminal.Core.MatchMode matchMode); diff --git a/src/cascadia/TerminalSettingsEditor/PreviewConnection.cpp b/src/cascadia/TerminalSettingsEditor/PreviewConnection.cpp index 6aefd53d12..c79391f3ec 100644 --- a/src/cascadia/TerminalSettingsEditor/PreviewConnection.cpp +++ b/src/cascadia/TerminalSettingsEditor/PreviewConnection.cpp @@ -8,7 +8,17 @@ using namespace ::winrt::Microsoft::Terminal::TerminalConnection; using namespace ::winrt::Windows::Foundation; -static constexpr std::wstring_view PreviewText{ L"Windows Terminal\r\nCopyright (c) Microsoft Corporation\r\n\nC:\\Windows\\Terminal> " }; +// clang-format off +static constexpr std::wstring_view PreviewText{ + L"Windows Terminal\r\n" + L"C:\\> \x1b[93m" L"git\x1b[m diff \x1b[90m-w\x1b[m\r\n" + L"\x1b[1m" L"diff --git a/win b/win\x1b[m\r\n" + L"\x1b[36m@@ -1 +1 @@\x1b[m\r\n" + L"\x1b[31m- Windows Console\x1b[m\r\n" + L"\x1b[32m- Windows Terminal!\x1b[m\r\n" + L"C:\\> \x1b[93mWrite-Host \x1b[36m\"\xd83e\xde9f!\"\x1b[1D\x1b[m" +}; +// clang-format on namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { @@ -16,8 +26,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation void PreviewConnection::Start() noexcept { - // First send a sequence to disable cursor blinking - _TerminalOutputHandlers(L"\x1b[?12l"); // Send the preview text _TerminalOutputHandlers(PreviewText); } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.cpp b/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.cpp index 7f14eb0d1b..599b3eef51 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.cpp +++ b/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.cpp @@ -39,6 +39,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _previewControl = Control::TermControl(settings, settings, make()); _previewControl.IsEnabled(false); _previewControl.AllowFocusWhenDisabled(false); + _previewControl.DisplayCursorWhileBlurred(true); ControlPreview().Child(_previewControl); } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.xaml b/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.xaml index 3af18b1223..710eb62ee1 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles_Appearance.xaml @@ -47,8 +47,8 @@