From 59d90c4ad7d09c95da2e3915c3e71b74dac672a5 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 26 Sep 2024 01:51:17 +0200 Subject: [PATCH] Slightly improve code readability --- console.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/console.c b/console.c index f0dd9e32..9598e2cf 100644 --- a/console.c +++ b/console.c @@ -2523,7 +2523,6 @@ static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qbool isCon int i, p; int match; int spos; - int digits = 0; int count = 0; if(!con_nickcompletion.integer) @@ -2564,9 +2563,11 @@ static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qbool isCon { if(line[spos] == '#') { - digits = (int) strspn(line+spos+1, "0123456789"); + int len = (int) strspn(line+spos+1, "0123456789"); // number of digits + if (line[pos-1] == ' ') + ++len; // word lenght EQUAL digits count OR digits count + 1 trailing space - if(((pos)-(spos+1)) == (line[pos-1] == ' ' ? digits+1 : digits) && p == (atoi(line+spos+1)-1)) + if(((pos)-(spos+1)) == len && p == (atoi(line+spos+1)-1)) match = spos; } } -- 2.39.2