From 84afe70c96a885d71cdc42c0bf1cf14e9cd24240 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:27:36 +0200 Subject: [PATCH] Fix crash when resizing and cursor is off screen --- YesNt.CodeEditor/Editor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/YesNt.CodeEditor/Editor.cs b/YesNt.CodeEditor/Editor.cs index d88677b..7637538 100644 --- a/YesNt.CodeEditor/Editor.cs +++ b/YesNt.CodeEditor/Editor.cs @@ -38,7 +38,7 @@ internal class TextEditor inputHandler = new InputHandler(this); Console.CancelKeyPress += Console_CancelKeyPress; - Timer timer = new Timer(500); + Timer timer = new Timer(100); timer.Elapsed += (s, e) => { if (SizeChanged() && EditMode != Mode.Debug) @@ -115,7 +115,7 @@ internal class TextEditor Console.SetCursorPosition(0, Console.WindowHeight - 2); Console.Write(">>>" + new string(' ', Console.WindowWidth - 3)); - Console.SetCursorPosition(Math.Min(CursorPosition.X + GetSpacing() + 2, Console.WindowWidth - 1), CursorPosition.Y - LineOffset); + Console.SetCursorPosition(Math.Min(CursorPosition.X + GetSpacing() + 2, Console.WindowWidth - 1), Math.Min(CursorPosition.Y - LineOffset, Console.WindowHeight - 4)); Console.CursorVisible = true; }