Add a fun new preview text in the SUI, enable the cursor (#15363)
Our existing preview text was not very helpful in learning how different
settings impacted the display of text in Terminal.
This new preview text contains:
* Bold text, which is controlled by intenseTextStyle
* Colors
* Emoji
* A cursor, which overlaps a single character to show inversion behavior
(cherry picked from commit fbe45fafb5
)
Service-Card-Id: 89230301
Service-Version: 1.17
This commit is contained in:
parent
e9074fe138
commit
d056f22219
|
@ -874,7 +874,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
// _cursorTimer doesn't exist, and it would never turn on the
|
// _cursorTimer doesn't exist, and it would never turn on the
|
||||||
// cursor. To mitigate, we'll initialize the cursor's 'on' state
|
// cursor. To mitigate, we'll initialize the cursor's 'on' state
|
||||||
// with `_focused` here.
|
// with `_focused` here.
|
||||||
_core.CursorOn(_focused);
|
_core.CursorOn(_focused || DisplayCursorWhileBlurred);
|
||||||
|
if (DisplayCursorWhileBlurred)
|
||||||
|
{
|
||||||
|
_cursorTimer->Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1749,7 +1753,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
TSFInputControl().NotifyFocusLeave();
|
TSFInputControl().NotifyFocusLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cursorTimer)
|
if (_cursorTimer && !DisplayCursorWhileBlurred)
|
||||||
{
|
{
|
||||||
_cursorTimer->Stop();
|
_cursorTimer->Stop();
|
||||||
_core.CursorOn(false);
|
_core.CursorOn(false);
|
||||||
|
|
|
@ -165,6 +165,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
|
|
||||||
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, BackgroundBrush, _PropertyChangedHandlers, nullptr);
|
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, BackgroundBrush, _PropertyChangedHandlers, nullptr);
|
||||||
|
|
||||||
|
public:
|
||||||
|
til::property<bool> DisplayCursorWhileBlurred{ false };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct TermControlT<TermControl>; // friend our parent so it can bind private event handlers
|
friend struct TermControlT<TermControl>; // friend our parent so it can bind private event handlers
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,8 @@ namespace Microsoft.Terminal.Control
|
||||||
// opacity set by the settings should call this instead.
|
// opacity set by the settings should call this instead.
|
||||||
Double BackgroundOpacity { get; };
|
Double BackgroundOpacity { get; };
|
||||||
|
|
||||||
|
Boolean DisplayCursorWhileBlurred;
|
||||||
|
|
||||||
Windows.UI.Xaml.Media.Brush BackgroundBrush { get; };
|
Windows.UI.Xaml.Media.Brush BackgroundBrush { get; };
|
||||||
|
|
||||||
void ColorSelection(SelectionColor fg, SelectionColor bg, Microsoft.Terminal.Core.MatchMode matchMode);
|
void ColorSelection(SelectionColor fg, SelectionColor bg, Microsoft.Terminal.Core.MatchMode matchMode);
|
||||||
|
|
|
@ -8,7 +8,17 @@
|
||||||
using namespace ::winrt::Microsoft::Terminal::TerminalConnection;
|
using namespace ::winrt::Microsoft::Terminal::TerminalConnection;
|
||||||
using namespace ::winrt::Windows::Foundation;
|
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
|
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||||
{
|
{
|
||||||
|
@ -16,8 +26,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||||
|
|
||||||
void PreviewConnection::Start() noexcept
|
void PreviewConnection::Start() noexcept
|
||||||
{
|
{
|
||||||
// First send a sequence to disable cursor blinking
|
|
||||||
_TerminalOutputHandlers(L"\x1b[?12l");
|
|
||||||
// Send the preview text
|
// Send the preview text
|
||||||
_TerminalOutputHandlers(PreviewText);
|
_TerminalOutputHandlers(PreviewText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||||
_previewControl = Control::TermControl(settings, settings, make<PreviewConnection>());
|
_previewControl = Control::TermControl(settings, settings, make<PreviewConnection>());
|
||||||
_previewControl.IsEnabled(false);
|
_previewControl.IsEnabled(false);
|
||||||
_previewControl.AllowFocusWhenDisabled(false);
|
_previewControl.AllowFocusWhenDisabled(false);
|
||||||
|
_previewControl.DisplayCursorWhileBlurred(true);
|
||||||
ControlPreview().Child(_previewControl);
|
ControlPreview().Child(_previewControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
<!-- Control Preview -->
|
<!-- Control Preview -->
|
||||||
<Border MaxWidth="{StaticResource StandardControlMaxWidth}">
|
<Border MaxWidth="{StaticResource StandardControlMaxWidth}">
|
||||||
<Border x:Name="ControlPreview"
|
<Border x:Name="ControlPreview"
|
||||||
Width="350"
|
Width="400"
|
||||||
Height="160"
|
Height="180"
|
||||||
Margin="0,0,0,12"
|
Margin="0,0,0,12"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
BorderBrush="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
BorderBrush="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||||
|
|
Loading…
Reference in New Issue