From 3d642b0313d856c3cfcafe50205ab81dbed24cab Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 18 Mar 2011 11:03:31 +0000 Subject: [PATCH] new con_closeontoggleconsole logic: 1 now only works at the start of the line, for all toggleconsole keys 2 works anywhere, if the key is not ^ 3 works anywhere, even if the key is ^ git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10929 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=9829ccb76b1b5f2cb18d14cae0092ab94f183ece --- keys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keys.c b/keys.c index cbc05ed0..a24e83fb 100644 --- a/keys.c +++ b/keys.c @@ -24,7 +24,7 @@ #include "cl_video.h" #include "utf8lib.h" -cvar_t con_closeontoggleconsole = {CVAR_SAVE, "con_closeontoggleconsole","1", "allows toggleconsole binds to close the console as well"}; +cvar_t con_closeontoggleconsole = {CVAR_SAVE, "con_closeontoggleconsole","1", "allows toggleconsole binds to close the console as well; when set to 2, this even works when not at the start of the line in console input; when set to 3, this works even if the toggleconsole key is the color tag"}; /* key up events are sent even if in console mode @@ -1864,7 +1864,7 @@ Key_Event (int key, int ascii, qboolean down) // con_closeontoggleconsole enables toggleconsole keys to close the // console, as long as they are not the color prefix character // (special exemption for german keyboard layouts) - if (con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && (key_consoleactive & KEY_CONSOLEACTIVE_USER) && ascii != STRING_COLOR_TAG) + if (con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && (key_consoleactive & KEY_CONSOLEACTIVE_USER) && (con_closeontoggleconsole.integer >= ((ascii != STRING_COLOR_TAG) ? 2 : 3) || key_linepos == 1)) { Con_ToggleConsole_f (); return; -- 2.39.2