diff --git a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs index fa3f9dfc..b2b42f91 100644 --- a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs +++ b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs @@ -47,29 +47,7 @@ public bool CaretVisible public PixelBufferSize Size { get; private set; } - public bool SupportsComplexEmoji - { - get - { - if (_supportEmoji == null) - { - // Detect complex emoji support by writing a complex emoji and checking cursor position. - // If the cursor moves 2 positions, it indicates proper rendering of composite surrogate pairs. - (int left, int top) = Console.GetCursorPosition(); - WriteText( - $"{Esc.Foreground(Colors.Transparent)}{Esc.Background(Colors.Transparent)}{TestEmoji}"); - - // TODO, escape sequence - (int left2, _) = Console.GetCursorPosition(); - _supportEmoji = left2 - left == 2; - Console.SetCursorPosition(left, top); - - WriteText(Esc.ClearScreen); - } - - return _supportEmoji ?? true; - } - } + public bool SupportsComplexEmoji => _supportEmoji ?? false; public void SetTitle(string title) { @@ -180,6 +158,15 @@ private void PrepareConsole() // enable alternate screen so original console screen is not affected by the app WriteText(Esc.EnableAlternateBuffer); WriteText(Esc.HideCursor); + // Detect complex emoji support by writing a complex emoji and checking cursor position. + // If the cursor moves 2 positions, it indicates proper rendering of composite surrogate pairs. + (int left, int top) = Console.GetCursorPosition(); + WriteText( + $"{Esc.Foreground(Colors.Transparent)}{Esc.Background(Colors.Transparent)}{TestEmoji}"); + (int left2, _) = Console.GetCursorPosition(); + _supportEmoji = left2 - left == 2; + Console.SetCursorPosition(left, top); + WriteText(Esc.ClearScreen); #pragma warning restore CA1303 // Do not pass literals as localized parameters }