shithub: rgbds

Download patch

ref: 0105779789909e2daad5aa09450dd3101aa5e723
parent: 9ef79546709eba56b45467206d0be20a1a7095b6
author: ISSOtm <eldredhabert0@gmail.com>
date: Wed Aug 10 04:44:41 EDT 2022

Fix incorrect Bash completions after `--long-opt=`

This is because `$COMP_CWORD` points to that `=` "word".

--- a/contrib/bash_compl/_rgbasm.bash
+++ b/contrib/bash_compl/_rgbasm.bash
@@ -130,7 +130,7 @@
 
 	# 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
--- a/contrib/bash_compl/_rgbfix.bash
+++ b/contrib/bash_compl/_rgbfix.bash
@@ -101,7 +101,7 @@
 
 	# 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
--- a/contrib/bash_compl/_rgbgfx.bash
+++ b/contrib/bash_compl/_rgbgfx.bash
@@ -109,7 +109,7 @@
 
 	# 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
--- a/contrib/bash_compl/_rgblink.bash
+++ b/contrib/bash_compl/_rgblink.bash
@@ -99,7 +99,7 @@
 
 	# 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