···4646 flagPrefix="-P \${BASH_REMATCH}"
4747 fi
48484949- # Prepare the command to obtain completions
5050- requestComp="${exec} complete -- \${words[2,-1]}"
4949+ # Prepare the command to obtain completions, ensuring arguments are quoted for eval
5050+ local -a args_to_quote=("\${(@)words[2,-1]}")
5151 if [ "\${lastChar}" = "" ]; then
5252 # If the last parameter is complete (there is a space following it)
5353 # We add an extra empty parameter so we can indicate this to the go completion code.
5454 __${name}_debug "Adding extra empty parameter"
5555- requestComp="\${requestComp} ''"
5555+ args_to_quote+=("")
5656 fi
5757+5858+ # Use Zsh's (q) flag to quote each argument safely for eval
5959+ local quoted_args=("\${(@q)args_to_quote}")
6060+6161+ # Join the main command and the quoted arguments into a single string for eval
6262+ requestComp="${exec} complete -- \${quoted_args[*]}"
57635864 __${name}_debug "About to call: eval \${requestComp}"
5965