disabled quick edit mode for the console on windows on default

This commit is contained in:
oy 2019-01-05 17:13:37 +01:00
parent 7bb1fa8a19
commit 1a883a4b70
3 changed files with 34 additions and 0 deletions

View file

@ -242,6 +242,24 @@ void dbg_logger_file(const char *filename)
dbg_msg("dbg/logger", "failed to open '%s' for logging", filename);
}
#if defined(CONF_FAMILY_WINDOWS)
static DWORD old_console_mode;
void dbg_console_init()
{
HANDLE handle;
handle = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(handle, &old_console_mode);
old_console_mode &= ~ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS;
SetConsoleMode(handle, old_console_mode);
}
void dbg_console_cleanup()
{
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), old_console_mode);
}
#endif
/* */
typedef struct MEMHEADER

View file

@ -1249,6 +1249,11 @@ void dbg_logger_stdout();
void dbg_logger_debugger();
void dbg_logger_file(const char *filename);
#if defined(CONF_FAMILY_WINDOWS)
void dbg_console_init();
void dbg_console_cleanup();
#endif
typedef struct
{
int sent_packets;

View file

@ -2449,8 +2449,13 @@ int main(int argc, const char **argv) // ignore_convention
#else
bool HideConsole = false;
#endif
bool QuickEditMode = false;
for(int i = 1; i < argc; i++) // ignore_convention
{
if(str_comp("--quickeditmode", argv[i]) == 0) // ignore_convention
{
QuickEditMode = true;
}
if(str_comp("-c", argv[i]) == 0 || str_comp("--console", argv[i]) == 0) // ignore_convention
{
HideConsole = false;
@ -2465,6 +2470,8 @@ int main(int argc, const char **argv) // ignore_convention
if(HideConsole)
FreeConsole();
else if(!QuickEditMode)
dbg_console_init();
#endif
bool UseDefaultConfig = false;
@ -2579,6 +2586,10 @@ int main(int argc, const char **argv) // ignore_convention
// write down the config and quit
pConfig->Save();
#if defined(CONF_FAMILY_WINDOWS)
if(!HideConsole && !QuickEditMode)
dbg_console_cleanup();
#endif
// free components
mem_free(pClient);
delete pKernel;