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

Re: bad math expression error inside _pick_variant when running insert-all-matches for ls



> On 28 September 2020 at 17:47 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > On 28 September 2020 at 17:30 Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> > On 9/28/20, lilydjwg <lilydjwg@xxxxxxxxx> wrote:
> > > bindkey '^Xi' insert-all-matches
> > >
> > > And then type:
> > >
> > > ls ^Xi
> > >
> > > There is an error message:
> > >
> > > _pick_variant:19: bad math expression: operand expected at `|| 0 ) '
> > >
> > > I'm using zsh 5.8 on Arch Linux.
> > 
> > You should either complain to the person who wrote insert-all-matches,
> > or provide the code here, otherwise nobody has any chance to guess
> > what's wrong.
> 
> While I was thinking that, I suspect that, whatever's causing this, changing
> $precommands[(I)builtin] on that line to ${precommands[(I)builtin]:-0]} would
> probably make it go away...

And a bit lower down... sorry, should probably have sent this before...
pws

--- a/Completion/Base/Utility/_pick_variant
+++ b/Completion/Base/Utility/_pick_variant
@@ -16,10 +16,10 @@ done
 
 if (( ${#precommands:|builtin_precommands} )); then
   pre=command
-elif (( $+opts[-b] && ( $precommands[(I)builtin] || $+builtins[$opts[-c]] ) )); then
+elif (( $+opts[-b] && ( ${precommands[(I)builtin]:-0} || $+builtins[$opts[-c]] ) )); then
   (( $+opts[-r] )) && : ${(P)opts[-r]::=$opts[-b]}
   return 0
-elif (( $precommands[(I)builtin] )); then
+elif (( ${precommands[(I)builtin]:-0} )); then
   pre=builtin
 else
   # Neither builtin nor command-forcing precommand specified,




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