mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
Crtl-C gives a new line when reading input
svn path=/trunk/; revision=19906
This commit is contained in:
parent
a0af76e470
commit
593d6d0f28
2 changed files with 24 additions and 4 deletions
|
@ -1449,7 +1449,7 @@ ProcessInput (BOOL bFlag)
|
||||||
ConOutPuts (commandline);
|
ConOutPuts (commandline);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*commandline)
|
if (*commandline && !CheckCtrlBreak(BREAK_INPUT))
|
||||||
{
|
{
|
||||||
ParseCommandLine (commandline);
|
ParseCommandLine (commandline);
|
||||||
if (bEcho && !bIgnoreEcho && (!bIsBatch || bEchoThisLine))
|
if (bEcho && !bIgnoreEcho && (!bIsBatch || bEchoThisLine))
|
||||||
|
@ -1469,8 +1469,25 @@ ProcessInput (BOOL bFlag)
|
||||||
BOOL WINAPI BreakHandler (DWORD dwCtrlType)
|
BOOL WINAPI BreakHandler (DWORD dwCtrlType)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
DWORD dwWritten;
|
||||||
|
INPUT_RECORD rec;
|
||||||
static BOOL SelfGenerated = FALSE;
|
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))
|
(dwCtrlType != CTRL_BREAK_EVENT))
|
||||||
{
|
{
|
||||||
|
|
|
@ -409,8 +409,9 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _T('M'):
|
case _T('M'):
|
||||||
|
case _T('C'):
|
||||||
/* ^M does the same as return */
|
/* ^M does the same as return */
|
||||||
if(!(ir.Event.KeyEvent.dwControlKeyState &
|
if(!(ir.Event.KeyEvent.dwControlKeyState &
|
||||||
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
|
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
|
||||||
|
@ -513,10 +514,12 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
|
||||||
}
|
}
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
|
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
|
||||||
if ((ch >= 32 && ch <= 255) && (charcount != (maxlen - 2)))
|
if ((ch >= 32 && ch <= 255) && (charcount != (maxlen - 2)) &&
|
||||||
|
!(ir.Event.KeyEvent.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
|
||||||
#else
|
#else
|
||||||
ch = ir.Event.KeyEvent.uChar.AsciiChar;
|
ch = ir.Event.KeyEvent.uChar.AsciiChar;
|
||||||
if ((UCHAR)ch >= 32 && (charcount != (maxlen - 2)))
|
if ((UCHAR)ch >= 32 && (charcount != (maxlen - 2)) &&
|
||||||
|
!(ir.Event.KeyEvent.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
|
||||||
#endif /* _UNICODE */
|
#endif /* _UNICODE */
|
||||||
{
|
{
|
||||||
/* insert character into string... */
|
/* insert character into string... */
|
||||||
|
|
Loading…
Reference in a new issue