Make sure that a CTRL+C doesn't carry over to another command.

svn path=/trunk/; revision=19933
This commit is contained in:
Brandon Turner
2005-12-06 19:11:08 +00:00
parent 558bc63003
commit 0ab577bd85
+18 -19
View File
@@ -681,8 +681,6 @@ DoCommand (LPTSTR line)
}
}
}
/* Just in case a CTRL+C slipped through a command */
bCtrlBreak = FALSE;
free(com);
}
@@ -1449,7 +1447,7 @@ ProcessInput (BOOL bFlag)
ConOutPuts (commandline);
}
if (*commandline && !CheckCtrlBreak(BREAK_INPUT))
if (!CheckCtrlBreak(BREAK_INPUT) && *commandline)
{
ParseCommandLine (commandline);
if (bEcho && !bIgnoreEcho && (!bIsBatch || bEchoThisLine))
@@ -1473,22 +1471,7 @@ BOOL WINAPI BreakHandler (DWORD dwCtrlType)
INPUT_RECORD rec;
static BOOL SelfGenerated = FALSE;
rec.EventType = KEY_EVENT;
rec.Event.KeyEvent.bKeyDown = TRUE;
rec.Event.KeyEvent.wRepeatCount = 1;
rec.Event.KeyEvent.wVirtualKeyCode = _T('C');
rec.Event.KeyEvent.wVirtualScanCode = _T('C') - 35;
rec.Event.KeyEvent.uChar.AsciiChar = _T('C');
rec.Event.KeyEvent.uChar.UnicodeChar = _T('C');
rec.Event.KeyEvent.dwControlKeyState = RIGHT_CTRL_PRESSED;
WriteConsoleInput(
hIn,
&rec,
1,
&dwWritten);
if ((dwCtrlType != CTRL_C_EVENT) &&
if ((dwCtrlType != CTRL_C_EVENT) &&
(dwCtrlType != CTRL_BREAK_EVENT))
{
return FALSE;
@@ -1509,6 +1492,22 @@ BOOL WINAPI BreakHandler (DWORD dwCtrlType)
return TRUE;
}
rec.EventType = KEY_EVENT;
rec.Event.KeyEvent.bKeyDown = TRUE;
rec.Event.KeyEvent.wRepeatCount = 1;
rec.Event.KeyEvent.wVirtualKeyCode = _T('C');
rec.Event.KeyEvent.wVirtualScanCode = _T('C') - 35;
rec.Event.KeyEvent.uChar.AsciiChar = _T('C');
rec.Event.KeyEvent.uChar.UnicodeChar = _T('C');
rec.Event.KeyEvent.dwControlKeyState = RIGHT_CTRL_PRESSED;
WriteConsoleInput(
hIn,
&rec,
1,
&dwWritten);
bCtrlBreak = TRUE;
/* FIXME: Handle batch files */