jfkeys: fix key levels not working at all

This commit is contained in:
Lephenixnoir 2022-12-01 11:00:41 +01:00
parent beeb0c0724
commit 40ffe54250
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 5 additions and 1 deletions

View File

@ -55,7 +55,11 @@ void jfkeys_set(jfkeys *f, char const *labels)
static char const *get_level(char const *labels, int level)
{
/* Navigate to level */
while(level > 0) labels = strchrnul(labels, '|');
while(level > 0) {
labels = strchrnul(labels, '|');
labels += (*labels == '|');
level--;
}
return (*labels == 0) ? NULL : labels;
}