Parcourir la source

highlight array assignments of the form x[y]=...

This code is more lenient than bash.  Examples:

    $ x[y[]=
    zsh: no matches found: x[y[]=
    $ x[][]=
    zsh: no matches found: x[][]=

The proper solution is to look inside the [...] and make sure that all
unescaped/unquoted square brackes are matched, but that is a heck of
a lot more complicated than this simple 8-character patch.
pull/131/head
Mark Lodato il y a 11 ans
Parent
révision
441f1a8aad
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. +1
    -1
      highlighters/main/main-highlighter.zsh

+ 1
- 1
highlighters/main/main-highlighter.zsh Voir le fichier

@ -153,7 +153,7 @@ _zsh_highlight_main_highlighter()
_zsh_highlight_main_highlighter_check_assign()
{
setopt localoptions extended_glob
[[ $arg == [[:alpha:]_]([[:alnum:]_])#=* ]]
[[ $arg == [[:alpha:]_][[:alnum:]_]#(|\[*\])=* ]]
}
# Check if the argument is a path.

Chargement…
Annuler
Enregistrer