|
From: KJK::Hyperion <no...@li...> - 2002-05-04 18:46:19
|
At 15.11 04/05/2002, you wrote:
>I've started to look at the input problems with MC now. Under Windows the
>input works fine. Under ReactOS the console is clearly reading in line mode.
>
>In (rosapps/mc/pc/key_nt.c) MC makes this call (line 187):
>win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw));
>
>It then goes on to process the one key returned. It obviously expects not
>to be in line mode.
No, wait, it's not reading *text* from the console, it's reading *input*.
Server-side buffering doesn't apply. Input can be *every kind* of input the
user sent to the console window. The second parameter is an array of
INPUT_RECORD buffers, and INPUT_RECORD is defined as:
typedef struct _INPUT_RECORD { // ir
WORD EventType;
union {
KEY_EVENT_RECORD KeyEvent;
MOUSE_EVENT_RECORD MouseEvent;
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
MENU_EVENT_RECORD MenuEvent;
FOCUS_EVENT_RECORD FocusEvent;
} Event;
} INPUT_RECORD;
Draw your own conclusions
>I'm really starting to doubt that the console is expected to be in line
>mode by default... is that documented anywhere?
Even if I'm sure it's not relevant to the issue, here you are:
"SetConsoleMode
[...]
dwMode
Specifies the input or output mode to set. If the hConsoleHandle
parameter is an input handle, the mode can be a combination of the
following values. WHEN A CONSOLE IS CREATED, ALL INPUT MODES EXCEPT
ENABLE_WINDOW_INPUT ARE ENABLED BY DEFAULT [emphasis mine].
Value Meaning
-----------------------------------------------------------------------------
ENABLE_LINE_INPUT The ReadFile or ReadConsole function returns only
when a carriage return character is read. If this
mode is disabled, the functions return when one or
more characters are available.
ENABLE_ECHO_INPUT Characters read by the ReadFile or ReadConsole
function are written to the active screen buffer as
they are read. This mode can be used only if the
ENABLE_LINE_INPUT mode is also enabled.
ENABLE_PROCESSED_INPUT CTRL+C is processed by the system and is not placed
in the input buffer. If the input buffer is being
read by ReadFile or ReadConsole, other control keys
are processed by the system and are not returned in
the ReadFile or ReadConsole buffer. If the
ENABLE_LINE_INPUT mode is also enabled, backspace,
carriage return, and linefeed characters are handled
by the system.
[ENABLE_WINDOW_INPUT omitted]
[ENABLE_MOUSE_INPUT omitted]
[...]"
|