Closed xoofx closed 2 years ago
I can reproduce this (in the scrolling
sample also).
This looks like a regression, actually. This used to work.
I suspect it's probably related to the whole ReadConsoleW
workaround on Windows:
Stepping through the code, ReadConsoleW
is doing exactly what it should be doing: Returning the pressed characters followed by \r
and \n
. Nothing unusual there.
Given that this works fine in Windows Terminal, I suspect a console host bug...
@xoofx I don't suppose you have a Windows 10 machine available to test on?
OK, ignore all of the above; my original hunch in https://github.com/alexrp/system-terminal/issues/9#issuecomment-1002928394 was correct. WindowsCancellationEvent
is the culprit. Removing the call to PollWithCancellation
makes things work.
Now to figure out why WaitForMultipleObjects
on the console input handle behaves differently between Windows Terminal and the Windows console host. Joy...
It appears that the console input buffer either contains slightly different input records than what we see with Windows Terminal, or that the console host processes them differently. Either way, the logic here is not working under the console host:
At this point I'm likely to just rip cancellation support out of the Windows driver. The amount of hacks I'm having to pile here to make what should be a simple poll(2)
call kinda-sorta work on Windows is getting out of hand.
Followup of #9 While trying this program with CMD outside of Windows Terminal:
The input seems to not always work on
ENTER
, sometimes it happens straight, sometimes it happens after the first inputted line. It works fine from the Windows Terminal though.0.5.39