[ros-diffs] [turner] 19906: Crtl-C gives a new line when reading input

turner at svn.reactos.com turner at svn.reactos.com
Mon Dec 5 03:59:41 CET 2005


Crtl-C gives a new line when reading input
Modified: trunk/reactos/subsys/system/cmd/cmd.c
Modified: trunk/reactos/subsys/system/cmd/cmdinput.c
  _____  

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-12-05 01:56:40 UTC
(rev 19905)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-12-05 02:59:29 UTC
(rev 19906)
@@ -1449,7 +1449,7 @@

 			ConOutPuts (commandline);
 		}
 
-		if (*commandline)
+		if (*commandline && !CheckCtrlBreak(BREAK_INPUT))
 		{
 			ParseCommandLine (commandline);
 			if (bEcho && !bIgnoreEcho && (!bIsBatch ||
bEchoThisLine))
@@ -1469,8 +1469,25 @@
 BOOL WINAPI BreakHandler (DWORD dwCtrlType)
 {
 
+	DWORD			dwWritten;
+	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) &&
 	    (dwCtrlType != CTRL_BREAK_EVENT))
 	{
  _____  

Modified: trunk/reactos/subsys/system/cmd/cmdinput.c
--- trunk/reactos/subsys/system/cmd/cmdinput.c	2005-12-05 01:56:40 UTC
(rev 19905)
+++ trunk/reactos/subsys/system/cmd/cmdinput.c	2005-12-05 02:59:29 UTC
(rev 19906)
@@ -409,8 +409,9 @@

 
 #endif
 				break;
-
+            
             case _T('M'):
+            case _T('C'):
                 /* ^M does the same as return */
                 if(!(ir.Event.KeyEvent.dwControlKeyState &
                    (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
@@ -513,10 +514,12 @@
 			}
 #ifdef _UNICODE
             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
             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 */
             {
                 /* insert character into string... */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051205/fd985643/attachment.html


More information about the Ros-diffs mailing list