[CMD] Fix CTRL-C handling.

Using CTRL-C to cancel command line input would leave the prompt in
a state where the next command would be ignored.  For example:

dir<CTRL-C>
dir

would cause cmd.exe to ignore the second dir command.
This commit is contained in:
James Woodcock 2018-04-27 16:15:38 +01:00 committed by Hermès Bélusca-Maïto
parent 23de2099e0
commit d7e71357dc
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 24 additions and 6 deletions

View file

@ -450,12 +450,23 @@ BOOL ReadCommand(LPTSTR str, INT maxlen)
break;
case _T('C'):
bCharInput = TRUE;
if (!(ir.Event.KeyEvent.dwControlKeyState &
if ((ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{
break;
/* A CTRL-C. Don't clear the the command line,
* but return an empty string in str. */
str[0] = L'\0';
curx = orgx;
cury = orgy;
current = charcount = 0;
bReturn = TRUE;
}
else
{
/* Just a normal 'C' character */
bCharInput = TRUE;
}
break;
case VK_RETURN:
/* end input, return to main */