Commit 8bc6e004 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Added a bit magic to CONSOLE_get_input so we don't get single Escapes

from function key escape sequences.
parent bcb7f4ee
...@@ -245,18 +245,36 @@ static void ...@@ -245,18 +245,36 @@ static void
CONSOLE_get_input( HANDLE handle, BOOL blockwait ) CONSOLE_get_input( HANDLE handle, BOOL blockwait )
{ {
char *buf = HeapAlloc(GetProcessHeap(),0,1); char *buf = HeapAlloc(GetProcessHeap(),0,1);
int len = 0; int len = 0, escape_seen = 0;
while (1) while (1)
{ {
DWORD res; DWORD res;
char inchar; char inchar;
if (WaitForSingleObject( handle, 0 )) break;
/* If we have at one time seen escape in this loop, we are
* within an Escape sequence, so wait for a bit more input for the
* rest of the loop.
*/
if (WaitForSingleObject( handle, escape_seen*10 )) break;
if (!ReadFile( handle, &inchar, 1, &res, NULL )) break; if (!ReadFile( handle, &inchar, 1, &res, NULL )) break;
if (!res) /* res 0 but readable means EOF? Hmm. */ if (!res) /* res 0 but readable means EOF? Hmm. */
break; break;
buf = HeapReAlloc(GetProcessHeap(),0,buf,len+1); buf = HeapReAlloc(GetProcessHeap(),0,buf,len+1);
buf[len++]=inchar; buf[len++]=inchar;
if (inchar == 27) {
if (len>1) {
/* If we spot an ESC, we flush all up to it
* since we can be sure that we have a complete
* sequence.
*/
CONSOLE_string_to_IR(handle,buf,len-1);
buf = HeapReAlloc(GetProcessHeap(),0,buf,1);
buf[0] = 27;
len = 1;
}
escape_seen = 1;
}
} }
CONSOLE_string_to_IR(handle,buf,len); CONSOLE_string_to_IR(handle,buf,len);
HeapFree(GetProcessHeap(),0,buf); HeapFree(GetProcessHeap(),0,buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment