]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
new con_closeontoggleconsole logic:
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Mar 2011 11:03:31 +0000 (11:03 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Mar 2011 11:03:31 +0000 (11:03 +0000)
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

keys.c

diff --git a/keys.c b/keys.c
index cbc05ed032900c19371062af3eea56a15352530d..a24e83fbfb980c3ce278946a384b99ba770c1e49 100644 (file)
--- 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;