fix getch spin

This commit is contained in:
Lion Kortlepel
2020-11-17 23:10:19 +01:00
parent 04de729d7c
commit a78f65b274
2 changed files with 12 additions and 3 deletions

View File

@@ -174,11 +174,19 @@ static void ProcessCompositeInput() {
}
}
[[noreturn]] void ReadCin() {
void ReadCin() {
DebugPrintTID();
size_t null_byte_counter = 0;
while (true) {
int In = _getch();
// info(std::to_string(In));
info(std::to_string(In));
if (In == 0) {
++null_byte_counter;
if (null_byte_counter > 0) {
info("too many null bytes in input, this is now assumed to be a background thread - console input is now disabled");
break;
}
}
if (CompositeInputExpected) {
CompositeInput += char(In);
#ifdef WIN32