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

fix for issue #189 slow startup #194

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Changes from 1 commit
Commits
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
34 changes: 11 additions & 23 deletions src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,7 @@

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 { get => _supportEmoji ?? false; }

Check notice on line 50 in src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs

View workflow job for this annotation

GitHub Actions / build

"[ArrangeAccessorOwnerBody] Code body does not conform to code style settings: use expression-bodied property" on /home/runner/work/Consolonia/Consolonia/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs(50,44)

public void SetTitle(string title)
{
Expand Down Expand Up @@ -180,6 +158,15 @@
// 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
}
Expand All @@ -195,6 +182,7 @@

protected void ActualizeSize()
{

Size = new PixelBufferSize((ushort)Console.WindowWidth, (ushort)Console.WindowHeight);
Resized?.Invoke();
}
Expand Down
Loading