Subject: | Win32: ReadKey(0) ignores Enter |
On Win32, in 'raw' mode, ReadKey(0) just ignores the Enter key. The
work-around is to use a really long delay rather than an infinite one,
for example, ReadKey(~0/2-1), which causes Enter to be returned as "\r".
So the fix is probably to move the call to PeekConsoleInput() from line
1571 of ReadKey.xs to be outside of the if() block:
PeekConsoleInput(whnd, &record, 1, &readRecords);
if (delay != 0) {
if (readRecords == 0)
return(FALSE);
}
or, more likely:
PeekConsoleInput(whnd, &record, 1, &readRecords);
if (delay != 0 && readRecords == 0)
return(FALSE);
}
No, I haven't spent much time trying to figure out why that appears to
make a difference.
It might be worth noting in the documentation that, depending on
platform and settings, the Enter key may be returns as "\r" or "\n"
(either can happen on Unix, there being a setting specifically for that
translation), so that more portable code is likely produced.