Automatically redraw console window when size chnages

This commit is contained in:
Stone_Red
2023-09-28 14:43:53 +02:00
parent ce3715c1b5
commit 1ac6d7790b
+17
View File
@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Timers;
using YesNt.Interpreter.Runtime; using YesNt.Interpreter.Runtime;
@@ -36,6 +37,22 @@ internal class TextEditor
syntaxHighlighter = new(YesNtInterpreter.StatementInformation); syntaxHighlighter = new(YesNtInterpreter.StatementInformation);
inputHandler = new InputHandler(this); inputHandler = new InputHandler(this);
Console.CancelKeyPress += Console_CancelKeyPress; Console.CancelKeyPress += Console_CancelKeyPress;
Timer timer = new Timer(500);
timer.Elapsed += (s, e) =>
{
if (SizeChanged() && EditMode != Mode.Debug)
{
Display(true);
if (EditMode == Mode.Command)
{
InputHandler.WriteStatus(string.Empty);
Console.SetCursorPosition(3, Console.WindowHeight - 2);
}
}
};
timer.Start();
} }
public void Run() public void Run()