]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audioc: Fix option completion of version and stat.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 4 May 2025 00:35:49 +0000 (02:35 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 18 May 2025 17:19:02 +0000 (19:19 +0200)
If the current word starts with a dash, we should always complete on options,
regardless of the word number.

audioc.c

index 1fa2d76c947bb88d9ccd35d09d03917b6113f47b..64afadcfddddbff6319a8fc7a2988d87b1d1c56f 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -119,7 +119,7 @@ static void version_completer(struct i9e_completion_info *ci,
 {
        char * const opts[] = {LSG_AUDIOD_CMD_VERSION_OPTS, NULL};
 
-       if (ci->word_num <= 2 && ci->word && ci->word[0] == '-')
+       if (ci->word[0] == '-')
                i9e_complete_option(opts, ci, cr);
 }
 
@@ -129,10 +129,9 @@ static void stat_completer(struct i9e_completion_info *ci,
        char *sia[] = {STATUS_ITEMS NULL};
        char * const opts[] = {LSG_AUDIOD_CMD_STAT_OPTS, NULL};
 
-       if (ci->word_num <= 2 && ci->word && ci->word[0] == '-')
-               i9e_complete_option(opts, ci, cr);
-       else
-               i9e_extract_completions(ci->word, sia, &cr->matches);
+       if (ci->word[0] == '-')
+               return i9e_complete_option(opts, ci, cr);
+       i9e_extract_completions(ci->word, sia, &cr->matches);
 }
 
 static void grab_completer(struct i9e_completion_info *ci,