From a3c89d6243aa09495e72dbc0e6392db3d58fb9b4 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 4 May 2025 02:35:49 +0200 Subject: [PATCH] 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. --- audioc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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, -- 2.39.5