From: Andre Noll Date: Sun, 4 May 2025 00:35:49 +0000 (+0200) Subject: audioc: Fix option completion of version and stat. X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=a3c89d6243aa09495e72dbc0e6392db3d58fb9b4;p=paraslash.git audioc: Fix option completion of version and stat. If the current word starts with a dash, we should always complete on options, regardless of the word number. --- diff --git a/audioc.c b/audioc.c index 1fa2d76c..64afadcf 100644 --- 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,