From 74fe98791acdade43a83047b5c4c7ba4ef8860c9 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 14 Apr 2009 18:12:46 +0000 Subject: [PATCH] nick completion bugfix by terencehill git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8928 d7cf8633-e32d-0410-b094-e92efae38249 --- console.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/console.c b/console.c index 6087f169..c3b274c8 100644 --- a/console.c +++ b/console.c @@ -2065,7 +2065,7 @@ int Nicks_CompleteCountPossible(char *line, int pos, char *s, qboolean isCon) match = -1; spos = pos - 1; // no need for a minimum of characters :) - while(spos >= 0 && (spos - pos) < length) // search-string-length < name length + while(spos >= 0) { if(spos > 0 && line[spos-1] != ' ' && line[spos-1] != ';' && line[spos-1] != '\"' && line[spos-1] != '\'') { @@ -2334,32 +2334,22 @@ int Nicks_AddLastColor(char *buffer, int pos) } if(!quote_added) { - if( buffer[pos-2] == STRING_COLOR_TAG && isdigit(buffer[pos-1]) ) // when thes use &4 - { + if( pos >= 2 && buffer[pos-2] == STRING_COLOR_TAG && isdigit(buffer[pos-1]) ) // when thes use &4 pos -= 2; - } - else if( pos >= 5 && buffer[pos-5] == STRING_COLOR_TAG && buffer[pos-4] == STRING_COLOR_RGB_TAG_CHAR) - { - if ( isxdigit(buffer[pos-3]) && isxdigit(buffer[pos-2]) && isxdigit(buffer[pos-1]) ) - { - pos -= 5; - color = -1; - } - } + else if( pos >= 5 && buffer[pos-5] == STRING_COLOR_TAG && buffer[pos-4] == STRING_COLOR_RGB_TAG_CHAR + && isxdigit(buffer[pos-3]) && isxdigit(buffer[pos-2]) && isxdigit(buffer[pos-1]) ) + pos -= 5; } + buffer[pos++] = STRING_COLOR_TAG; if (color == -1) { - buffer[pos++] = STRING_COLOR_TAG; buffer[pos++] = STRING_COLOR_RGB_TAG_CHAR; buffer[pos++] = r; buffer[pos++] = g; buffer[pos++] = b; } else - { - buffer[pos++] = STRING_COLOR_TAG; buffer[pos++] = color; - } } return pos; } @@ -2387,7 +2377,7 @@ int Nicks_CompleteChatLine(char *buffer, size_t size, unsigned int pos) { int len; char *msg; - Con_Printf("\n%i possible nick%s\n", n, (n > 1) ? "s: " : ":"); + Con_Printf("\n%i possible nicks:\n", n); Cmd_CompleteNicksPrint(n); Nicks_CutMatches(n); -- 2.39.2