Skip to content

Commit

Permalink
fix redirected input
Browse files Browse the repository at this point in the history
  • Loading branch information
WouterTinus committed Feb 2, 2024
1 parent cd144f8 commit 12a6c29
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main.lib/Services/InputService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ public void CreateSpace()
}
}

private const string Black = "\u001b[40m";
private const string Reset = "\u001b[0m";
private static void WriteLine(string? text = "", ConsoleColor? color = null)
{
text ??= "";
var size = Console.WindowWidth - 1;
if (size != Console.CursorLeft + 1)
{
size -= Console.CursorLeft;
}
if (size < text.Length)
var size = -1;
if (!Console.IsOutputRedirected)
{
size = Console.WindowWidth + size;
size = Console.WindowWidth - 1;
if (size != Console.CursorLeft + 1)
{
size -= Console.CursorLeft;
}
if (size < text.Length)
{
size = Console.WindowWidth + size;
}
}
if (size < 0)
{
Expand All @@ -62,6 +64,8 @@ private static void WriteLine(string? text = "", ConsoleColor? color = null)
Write($"{text.PadRight(size)}\n", color);
}

private const string Black = "\u001b[40m";
private const string Reset = "\u001b[0m";
private static void Write(string? text = "", ConsoleColor? color = null)
{
text ??= "";
Expand Down

0 comments on commit 12a6c29

Please sign in to comment.