Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _describe bug?



Thanks, I had to work out this myself :)

On 09/20/14 08:17, Bart Schaefer wrote:
> On Sep 19,  8:33pm, Vasiliy Ivanov wrote:
> } 
> } Recently I noticed completion bug in _describe - if one provided name2
> } parameter (which made name2 array behave as completion list and name1
> } - as label:description list, according to zshcompsys), then completion
> } is offered only for (alphabetically?) first completion element:
> } 
> } #compdef testcmd
> } local -a lbl compl
> } lbl=(BBC BB BA AB AA)
> } compl=(bbc bb ba ab aa)
> } _describe 'whatever' lbl compl
> } 
> } $ testcmd a<tab>
> } <nothing>
> 
> Puzzling how this one went unnoticed for so long.  The non-matching
> descriptions were being discarded but the list of matching completions
> was not being updated to correspond, so the arrays of descriptions and
> completions were of different lengths and confusion resulted.
> 
> 
> diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe
> index f899b0a..1a9f52f 100644
> --- a/Completion/Base/Utility/_describe
> +++ b/Completion/Base/Utility/_describe
> @@ -96,7 +96,7 @@ while _tags; do
>          fi
>      
>          if [[ -n $_mats ]]; then
> -          compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \
> +          compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs -O $_mats - \
>                    "${(@)${(@M)${(@P)_mats}##([^:\\]|\\?)##}//\\(#b)(?)/$match[1]}"
>          else
>            compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \
> 

-- 
Regards,
  Vasiliy Ivanov <beelzebubbie.logs@xxxxxxxxx>



Messages sorted by: Reverse Date, Date, Thread, Author