Fix MapConsoleKeyInfo not working with Esc properly

This commit is contained in:
tznind
2024-10-27 17:08:27 +00:00
parent 792170a029
commit b30c92bceb

View File

@@ -970,6 +970,18 @@ public static class EscSeqUtils
break;
case uint n when n > 0 && n <= KeyEsc:
if (n == KeyEsc)
{
key= ConsoleKey.Escape;
newConsoleKeyInfo = new ConsoleKeyInfo (
consoleKeyInfo.KeyChar,
key,
(consoleKeyInfo.Modifiers & ConsoleModifiers.Shift) != 0,
(consoleKeyInfo.Modifiers & ConsoleModifiers.Alt) != 0,
(consoleKeyInfo.Modifiers & ConsoleModifiers.Control) != 0);
}
else
if (consoleKeyInfo.Key == 0 && consoleKeyInfo.KeyChar == '\r')
{
key = ConsoleKey.Enter;