]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Autocompletion by # SHIFT-TAB: fix condition to detect # working even if there's...
authorterencehill <piuntn@gmail.com>
Sat, 28 Sep 2024 00:54:20 +0000 (02:54 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 28 Sep 2024 09:29:47 +0000 (11:29 +0200)
console.c

index 22ba40feaa8fadac77b0e63afd23a319cc1c5372..9acfe1465d102ba25e7a0cf5086c8a80e3dec0cf 100644 (file)
--- a/console.c
+++ b/console.c
@@ -2578,20 +2578,23 @@ static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qbool isCon
                        {
                                if(line[spos] == '#')
                                {
-                                       int len = (int) strspn(line+spos+1, "0123456789"); // number of digits
-                                       if (len == 0)
+                                       if (line[spos + 1] == 0)
                                        {
                                                if (p == hash_completion_player)
                                                        match = spos;
                                        }
                                        else
                                        {
-                                               hash_completion_player = -1;
-                                               if (line[pos-1] == ' ')
-                                                       ++len;
-                                               // word lenght EQUAL digits count OR digits count + 1 trailing space
-                                               if(((pos)-(spos+1)) == len && p == (atoi(line+spos+1)-1))
-                                                       match = spos;
+                                               int len = (int) strspn(line+spos+1, "0123456789"); // number of digits
+                                               if (len > 0)
+                                               {
+                                                       hash_completion_player = -1;
+                                                       if (line[pos-1] == ' ')
+                                                               ++len;
+                                                       // word lenght EQUAL digits count OR digits count + 1 trailing space
+                                                       if(((pos)-(spos+1)) == len && p == (atoi(line+spos+1)-1))
+                                                               match = spos;
+                                               }
                                        }
                                }
                        }