Skip to content

Commit 1863c5c

Browse files
committed
Adding SafeConsole.SetCursorPosition
1 parent 59e5215 commit 1863c5c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ConsoleGUI/Api/StandardConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Size Size
1414
get => new Size(Console.WindowWidth, Console.WindowHeight);
1515
set
1616
{
17-
Console.SetCursorPosition(0, 0);
17+
SafeConsole.SetCursorPosition(0, 0);
1818
SafeConsole.SetWindowPosition(0, 0);
1919
if (!(Size <= value)) SafeConsole.SetWindowSize(1, 1);
2020
SafeConsole.SetBufferSize(value.Width, value.Height);

ConsoleGUI/Utils/SafeConsole.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ namespace ConsoleGUI.Utils
66
{
77
internal static class SafeConsole
88
{
9+
public static void SetCursorPosition(int left, int top)
10+
{
11+
try
12+
{
13+
Console.SetCursorPosition(left, top);
14+
}
15+
catch (Exception)
16+
{ }
17+
}
18+
919
public static void SetWindowPosition(int left, int top)
1020
{
1121
try

0 commit comments

Comments
 (0)