Set the edition mode as a specific attribute, not an extension of the

console mode.
This commit is contained in:
Eric Pouech 2003-01-09 06:01:32 +00:00 committed by Alexandre Julliard
parent 9957754bd8
commit fa8b85aa5c
9 changed files with 44 additions and 6 deletions

View file

@ -1053,7 +1053,7 @@ BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer,
if (!S_EditString || S_EditString[S_EditStrPos] == 0) if (!S_EditString || S_EditString[S_EditStrPos] == 0)
{ {
if (S_EditString) HeapFree(GetProcessHeap(), 0, S_EditString); if (S_EditString) HeapFree(GetProcessHeap(), 0, S_EditString);
if (!(S_EditString = CONSOLE_Readline(hConsoleInput, mode & WINE_ENABLE_LINE_INPUT_EMACS))) if (!(S_EditString = CONSOLE_Readline(hConsoleInput)))
return FALSE; return FALSE;
S_EditStrPos = 0; S_EditStrPos = 0;
} }
@ -2242,3 +2242,21 @@ unsigned CONSOLE_GetNumHistoryEntries(void)
SERVER_END_REQ; SERVER_END_REQ;
return ret; return ret;
} }
/******************************************************************
* CONSOLE_GetEditionMode
*
*
*/
BOOL CONSOLE_GetEditionMode(HANDLE hConIn, int* mode)
{
unsigned ret = FALSE;
SERVER_START_REQ(get_console_input_info)
{
req->handle = hConIn;
if ((ret = !wine_server_call_err( req )))
*mode = reply->edition_mode;
}
SERVER_END_REQ;
return ret;
}

View file

@ -28,8 +28,9 @@ extern int CONSOLE_GetHistory(int idx, WCHAR* buf, int buf_len);
extern BOOL CONSOLE_AppendHistory(const WCHAR *p); extern BOOL CONSOLE_AppendHistory(const WCHAR *p);
extern unsigned CONSOLE_GetNumHistoryEntries(void); extern unsigned CONSOLE_GetNumHistoryEntries(void);
extern void CONSOLE_FillLineUniform(HANDLE hConsoleOutput, int i, int j, int len, LPCHAR_INFO lpFill); extern void CONSOLE_FillLineUniform(HANDLE hConsoleOutput, int i, int j, int len, LPCHAR_INFO lpFill);
extern BOOL CONSOLE_GetEditionMode(HANDLE, int*);
/* editline.c */ /* editline.c */
extern WCHAR* CONSOLE_Readline(HANDLE, int); extern WCHAR* CONSOLE_Readline(HANDLE);
#endif /* __WINE_CONSOLE_PRIVATE_H */ #endif /* __WINE_CONSOLE_PRIVATE_H */

View file

@ -785,7 +785,7 @@ KeyMap Win32KeyMap[] =
* *
* ====================================================================*/ * ====================================================================*/
WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, int use_emacs) WCHAR* CONSOLE_Readline(HANDLE hConsoleIn)
{ {
WCEL_Context ctx; WCEL_Context ctx;
INPUT_RECORD ir; INPUT_RECORD ir;
@ -794,10 +794,15 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, int use_emacs)
unsigned ofs; unsigned ofs;
void (*func)(struct WCEL_Context* ctx); void (*func)(struct WCEL_Context* ctx);
DWORD ks; DWORD ks;
int use_emacs;
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
ctx.hConIn = hConsoleIn; ctx.hConIn = hConsoleIn;
WCEL_HistoryInit(&ctx); WCEL_HistoryInit(&ctx);
if (!CONSOLE_GetEditionMode(hConsoleIn, &use_emacs))
use_emacs = 0;
if ((ctx.hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, if ((ctx.hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE || OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE ||
!GetConsoleScreenBufferInfo(ctx.hConOut, &ctx.csbi)) !GetConsoleScreenBufferInfo(ctx.hConOut, &ctx.csbi))

View file

@ -35,8 +35,6 @@ extern "C" {
#define ENABLE_ECHO_INPUT 0x04 #define ENABLE_ECHO_INPUT 0x04
#define ENABLE_WINDOW_INPUT 0x08 #define ENABLE_WINDOW_INPUT 0x08
#define ENABLE_MOUSE_INPUT 0x10 #define ENABLE_MOUSE_INPUT 0x10
/* Wine only code (extension) */
#define WINE_ENABLE_LINE_INPUT_EMACS 0x80
#define ENABLE_PROCESSED_OUTPUT 0x01 #define ENABLE_PROCESSED_OUTPUT 0x01
#define ENABLE_WRAP_AT_EOL_OUTPUT 0x02 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02

View file

@ -1164,6 +1164,7 @@ struct set_console_input_info_request
obj_handle_t active_sb; obj_handle_t active_sb;
int history_mode; int history_mode;
int history_size; int history_size;
int edition_mode;
/* VARARG(title,unicode_str); */ /* VARARG(title,unicode_str); */
}; };
struct set_console_input_info_reply struct set_console_input_info_reply
@ -1174,6 +1175,7 @@ struct set_console_input_info_reply
#define SET_CONSOLE_INPUT_INFO_TITLE 0x02 #define SET_CONSOLE_INPUT_INFO_TITLE 0x02
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE 0x10
@ -1188,6 +1190,7 @@ struct get_console_input_info_reply
int history_mode; int history_mode;
int history_size; int history_size;
int history_index; int history_index;
int edition_mode;
/* VARARG(title,unicode_str); */ /* VARARG(title,unicode_str); */
}; };
@ -3532,6 +3535,6 @@ union generic_reply
struct get_next_hook_reply get_next_hook_reply; struct get_next_hook_reply get_next_hook_reply;
}; };
#define SERVER_PROTOCOL_VERSION 95 #define SERVER_PROTOCOL_VERSION 96
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View file

@ -241,6 +241,7 @@ static struct object *create_console_input( struct thread* renderer )
console_input->history = calloc( console_input->history_size, sizeof(WCHAR*) ); console_input->history = calloc( console_input->history_size, sizeof(WCHAR*) );
console_input->history_index = 0; console_input->history_index = 0;
console_input->history_mode = 0; console_input->history_mode = 0;
console_input->edition_mode = 0;
if (!console_input->history || !console_input->evt) if (!console_input->history || !console_input->evt)
{ {
@ -666,6 +667,10 @@ static int set_console_input_info( const struct set_console_input_info_request *
console->history = mem; console->history = mem;
console->history_size = req->history_size; console->history_size = req->history_size;
} }
if (req->mask & SET_CONSOLE_INPUT_INFO_EDITION_MODE)
{
console->edition_mode = req->edition_mode;
}
release_object( console ); release_object( console );
return 1; return 1;
error: error:
@ -1363,6 +1368,8 @@ DECL_HANDLER(get_console_input_info)
reply->history_mode = console->history_mode; reply->history_mode = console->history_mode;
reply->history_size = console->history_size; reply->history_size = console->history_size;
reply->history_index = console->history_index; reply->history_index = console->history_index;
reply->edition_mode = console->edition_mode;
release_object( console ); release_object( console );
} }

View file

@ -41,6 +41,7 @@ struct console_input
int history_size; /* number of entries in history array */ int history_size; /* number of entries in history array */
int history_index; /* number of used entries in history array */ int history_index; /* number of used entries in history array */
int history_mode; /* mode of history (non zero means remove doubled strings */ int history_mode; /* mode of history (non zero means remove doubled strings */
int edition_mode; /* index to edition mode flavors */
}; };
/* console functions */ /* console functions */

View file

@ -864,12 +864,14 @@ struct console_renderer_event
obj_handle_t active_sb; /* active screen buffer */ obj_handle_t active_sb; /* active screen buffer */
int history_mode; /* whether we duplicate lines in history */ int history_mode; /* whether we duplicate lines in history */
int history_size; /* number of lines in history */ int history_size; /* number of lines in history */
int edition_mode; /* index to the edition mode flavors */
VARARG(title,unicode_str); /* console title */ VARARG(title,unicode_str); /* console title */
@END @END
#define SET_CONSOLE_INPUT_INFO_ACTIVE_SB 0x01 #define SET_CONSOLE_INPUT_INFO_ACTIVE_SB 0x01
#define SET_CONSOLE_INPUT_INFO_TITLE 0x02 #define SET_CONSOLE_INPUT_INFO_TITLE 0x02
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE 0x10
/* Get info about a console (input only) */ /* Get info about a console (input only) */
@ -879,6 +881,7 @@ struct console_renderer_event
int history_mode; /* whether we duplicate lines in history */ int history_mode; /* whether we duplicate lines in history */
int history_size; /* number of lines in history */ int history_size; /* number of lines in history */
int history_index; /* number of used lines in history */ int history_index; /* number of used lines in history */
int edition_mode; /* index to the edition mode flavors */
VARARG(title,unicode_str); /* console title */ VARARG(title,unicode_str); /* console title */
@END @END

View file

@ -1027,6 +1027,7 @@ static void dump_set_console_input_info_request( const struct set_console_input_
fprintf( stderr, " active_sb=%p,", req->active_sb ); fprintf( stderr, " active_sb=%p,", req->active_sb );
fprintf( stderr, " history_mode=%d,", req->history_mode ); fprintf( stderr, " history_mode=%d,", req->history_mode );
fprintf( stderr, " history_size=%d,", req->history_size ); fprintf( stderr, " history_size=%d,", req->history_size );
fprintf( stderr, " edition_mode=%d,", req->edition_mode );
fprintf( stderr, " title=" ); fprintf( stderr, " title=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }
@ -1041,6 +1042,7 @@ static void dump_get_console_input_info_reply( const struct get_console_input_in
fprintf( stderr, " history_mode=%d,", req->history_mode ); fprintf( stderr, " history_mode=%d,", req->history_mode );
fprintf( stderr, " history_size=%d,", req->history_size ); fprintf( stderr, " history_size=%d,", req->history_size );
fprintf( stderr, " history_index=%d,", req->history_index ); fprintf( stderr, " history_index=%d,", req->history_index );
fprintf( stderr, " edition_mode=%d,", req->edition_mode );
fprintf( stderr, " title=" ); fprintf( stderr, " title=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }