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

Bug in ${(z)...} lexing, or what?



This has me baffled.

Consider the following innocuous-looking function:

widget() {
   zle up-history
   lastcmd=( ${(z)BUFFER} )
   zle down-history
}

Now try this:

zagzig% zle -N widget
zagzig% bindkey '\e=' widget
zagzig% ( setopt extendedglob ; [[ 'foo[x]=y' = (#i)[[:alpha:]][][[:alnum:]]#=* ]] )
zagzig% echo $lastcmd
( setopt extendedglob ; [[ 'foo[x]=y' = ( ;
zagzig% 

What happened to everything after the '#' in '(#i)' ??  And where did that
extra semicolon come from?

The really strange thing is that this happens only in ZLE widgets, and only
when there's a command separator (semi, amper, pipe, etc.) somewhere to the
left of the [[ ]] expression.  If I try the same thing outside of ZLE, it
works perfectly; if I try a bare glob (not in [[ ... ]]) it also works.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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