Quellcode durchsuchen

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 vor 11 Jahren
Ursprung
Commit
441f1a8aad
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. +1
    -1
      highlighters/main/main-highlighter.zsh

+ 1
- 1
highlighters/main/main-highlighter.zsh Datei anzeigen

@ -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.

Laden…
Abbrechen
Speichern