fix next_char

This commit is contained in:
Fritz Grimpen 2025-02-06 22:32:09 +01:00
parent 27bfbe6ef4
commit 6c163d8eb0

View file

@ -73,14 +73,12 @@ char *next_char(char *needle)
int db; int db;
if (*needle && *needle != '[') if (*needle && *needle != '[')
return needle + 1; return needle + 1;
for (db = (*needle == '[' ? 2 : 0); for (db = 1;
*needle && (*needle != ']' || db); *needle && (*needle != ']' || db);
needle++) needle++)
{ if (db)
if (db > 1)
db--; db--;
} return needle + 1;
return needle;
} }
// Find first character behind the closing parenthesis of the current group, or end of string // Find first character behind the closing parenthesis of the current group, or end of string