From 0105779789909e2daad5aa09450dd3101aa5e723 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 10 Aug 2022 08:44:41 +0200 Subject: [PATCH] Fix incorrect Bash completions after `--long-opt=` This is because `$COMP_CWORD` points to that `=` "word". --- contrib/bash_compl/_rgbasm.bash | 2 +- contrib/bash_compl/_rgbfix.bash | 2 +- contrib/bash_compl/_rgbgfx.bash | 2 +- contrib/bash_compl/_rgblink.bash | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/bash_compl/_rgbasm.bash b/contrib/bash_compl/_rgbasm.bash index 80665ad8..f07a0ab4 100755 --- a/contrib/bash_compl/_rgbasm.bash +++ b/contrib/bash_compl/_rgbasm.bash @@ -130,7 +130,7 @@ _rgbasm_completions() { # Parse current word # Careful that it might look like an option, so use `--` aggressively! - local cur_word="${COMP_WORDS[$COMP_CWORD]}" + local cur_word="${COMP_WORDS[$i]}" # Process options, as short ones may change the state if $opt_ena && [[ "$state" = 'normal' && "$cur_word" = '-'* ]]; then diff --git a/contrib/bash_compl/_rgbfix.bash b/contrib/bash_compl/_rgbfix.bash index eab5b05a..66972fda 100755 --- a/contrib/bash_compl/_rgbfix.bash +++ b/contrib/bash_compl/_rgbfix.bash @@ -101,7 +101,7 @@ _rgbfix_completions() { # Parse current word # Careful that it might look like an option, so use `--` aggressively! - local cur_word="${COMP_WORDS[$COMP_CWORD]}" + local cur_word="${COMP_WORDS[$i]}" # Process options, as short ones may change the state if $opt_ena && [[ "$state" = 'normal' && "$cur_word" = '-'* ]]; then diff --git a/contrib/bash_compl/_rgbgfx.bash b/contrib/bash_compl/_rgbgfx.bash index f174c2c9..0a5b87ed 100755 --- a/contrib/bash_compl/_rgbgfx.bash +++ b/contrib/bash_compl/_rgbgfx.bash @@ -109,7 +109,7 @@ _rgbgfx_completions() { # Parse current word # Careful that it might look like an option, so use `--` aggressively! - local cur_word="${COMP_WORDS[$COMP_CWORD]}" + local cur_word="${COMP_WORDS[$i]}" # Process options, as short ones may change the state if $opt_ena && [[ "$state" = 'normal' && "$cur_word" = '-'* ]]; then diff --git a/contrib/bash_compl/_rgblink.bash b/contrib/bash_compl/_rgblink.bash index b4f9e398..28eeb96b 100755 --- a/contrib/bash_compl/_rgblink.bash +++ b/contrib/bash_compl/_rgblink.bash @@ -99,7 +99,7 @@ _rgblink_completions() { # Parse current word # Careful that it might look like an option, so use `--` aggressively! - local cur_word="${COMP_WORDS[$COMP_CWORD]}" + local cur_word="${COMP_WORDS[$i]}" # Process options, as short ones may change the state if $opt_ena && [[ "$state" = 'normal' && "$cur_word" = '-'* ]]; then