]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
console: CTRL+SHIFT+ARROW breaks on underscore for long_cvar_lines
authornyov <nyov@nexnode.net>
Sat, 3 Dec 2011 17:29:06 +0000 (18:29 +0100)
committernyov <nyov@nexnode.net>
Sat, 3 Dec 2011 20:15:45 +0000 (21:15 +0100)
I tried making this less code bloat with a loop but utterly failed.

keys.c

diff --git a/keys.c b/keys.c
index 2369407fec82cd7bb7ad6c32a36d01bbbe4d2bfa..123746ed3c2b8f8f1326dea6e333d07c822ad264 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -889,16 +889,32 @@ Key_Console (int key, int unicode)
                                while(--pos)
                                {
                                        k = key_line[pos];
-                                       if (!(k == '\"' || k == ';' || k == ' ' || k == '\''))
-                                               break;
+                                       if (keydown[K_SHIFT]) // nyov: backtracking in very_long_grouped_cvar_strangeness (ctrl+k helps)
+                                       {
+                                               if (!(k == '\"' || k == ';' || k == ' ' || k == '\'' || k == '_'))
+                                                       break;
+                                       }
+                                       else
+                                       {
+                                               if (!(k == '\"' || k == ';' || k == ' ' || k == '\''))
+                                                       break;
+                                       }
                                }
 
                        if(pos)
                                while(--pos)
                                {
                                        k = key_line[pos];
-                                       if(k == '\"' || k == ';' || k == ' ' || k == '\'')
-                                               break;
+                                       if (keydown[K_SHIFT])
+                                       {
+                                               if(k == '\"' || k == ';' || k == ' ' || k == '\'' || k == '_')
+                                                       break;
+                                       }
+                                       else
+                                       {
+                                               if(k == '\"' || k == ';' || k == ' ' || k == '\'')
+                                                       break;
+                                       }
                                }
                        key_linepos = pos + 1;
                }
@@ -975,16 +991,32 @@ Key_Console (int key, int unicode)
                        while(++pos < len)
                        {
                                k = key_line[pos];
-                               if(k == '\"' || k == ';' || k == ' ' || k == '\'')
-                                       break;
+                               if (keydown[K_SHIFT]) // nyov: backtracking in very_long_grouped_cvar_strangeness (ctrl+k helps)
+                               {
+                                       if(k == '\"' || k == ';' || k == ' ' || k == '\'' || k == '_')
+                                               break;
+                               }
+                               else
+                               {
+                                       if(k == '\"' || k == ';' || k == ' ' || k == '\'')
+                                               break;
+                               }
                        }
                        
                        if (pos < len) // skip all "; ' after the word
                                while(++pos < len)
                                {
                                        k = key_line[pos];
-                                       if (!(k == '\"' || k == ';' || k == ' ' || k == '\''))
-                                               break;
+                                       if (keydown[K_SHIFT]) // nyov: backtracking in very_long_grouped_cvar_strangeness (ctrl+k helps)
+                                       {
+                                               if (!(k == '\"' || k == ';' || k == ' ' || k == '\'' || k == '_'))
+                                                       break;
+                                       }
+                                       else
+                                       {
+                                               if (!(k == '\"' || k == ';' || k == ' ' || k == '\''))
+                                                       break;
+                                       }
                                }
                        key_linepos = pos;
                }