Prevents an alone escape being eating by the response.

This commit is contained in:
BDisp
2024-11-11 23:27:47 +00:00
parent 54f62645a2
commit a3c961ef3f

View File

@@ -91,14 +91,15 @@ internal class WindowsConsole
// Check if input is part of an ANSI escape sequence
if (inputChar == '\u001B') // Escape character
{
// Peek to check if there is any input available with key event and bKeyDown
// Peek to check if there is any input available with key event and bKeyDown and not Escape character
if (PeekConsoleInput (_inputHandle, out InputRecord peekRecord, BUFFER_SIZE, out eventsRead) && eventsRead > 0)
{
if (peekRecord is { EventType: EventType.Key, KeyEvent.bKeyDown: true })
if (peekRecord is { EventType: EventType.Key, KeyEvent.bKeyDown: true, KeyEvent.UnicodeChar: not '\u001B' })
{
// It's really an ANSI request response
readingSequence = true;
ansiSequence.Clear (); // Start a new sequence
// Start a new sequence ensuring in the cases where wasn't clear by reading the terminator
ansiSequence.Clear ();
ansiSequence.Append (inputChar);
continue;
@@ -127,7 +128,10 @@ internal class WindowsConsole
}
}
continue;
if (readingSequence)
{
continue;
}
}
}
}