From 52aeb9aaeb4799b760138a7c34b18ede4b47242a Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 18 May 2015 09:56:00 +0100 Subject: 35168: Improve parsing of case patterns. "|" is now found properly by looking for words that come from the lexical analyser, rather than hacking a pattern returned in one dollop. Update some completion functions that need extra quoting as a result. Add test for new parsing. Update version number to 5.0.8-dev-3 because of wordcode incompatibility. --- Completion/Unix/Command/_ant | 3 +-- Completion/Unix/Command/_cp | 2 +- Completion/Unix/Command/_locate | 2 +- Completion/Unix/Command/_make | 6 +++--- Completion/Unix/Command/_tar | 2 +- Completion/Unix/Type/_path_commands | 2 +- Completion/X/Command/_xrandr | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) (limited to 'Completion') diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 8e4bd82af..ee9f7d910 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -123,8 +123,7 @@ case $state in # Output target again indicating its the default one. print -n "'${default_target}:(Default target) ' " ;; - (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time: - *) + (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time:*) ;; (*) # Return target and description diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp index 4c4dea2e9..7087b4e6c 100644 --- a/Completion/Unix/Command/_cp +++ b/Completion/Unix/Command/_cp @@ -13,7 +13,7 @@ if _pick_variant gnu=GNU unix --version; then '-H[follow command-line symbolic links]' \ '(-l --link)'{-l,--link}'[link files instead of copying]' \ '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \ - (-n --no-clobber -i --interactive){-n,--no-clobber}"[don't overwrite an existing file]" \ + '(-n --no-clobber -i --interactive)'{-n,--no-clobber}"[don't overwrite an existing file]" \ '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \ '-p[same as --preserve=mode,ownership,timestamps]' \ '--preserve=-[preserve specified attributes]:: :_values -s , attribute mode timestamps ownership links context xattr all' \ diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 0b35b7cdd..694f506c3 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -25,7 +25,7 @@ case $basename in ltype=gnu ;; - (*illegal option*) + (*"illegal option"*) if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then ltype=bsd else diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 225c0af85..c14a34c58 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -65,7 +65,7 @@ _make-parseMakefile () { do case "$input " in # VARIABLE = value OR VARIABLE ?= value - ([[:alnum:]][[:alnum:]_]#[ $TAB]#(\?|)=*) + ([[:alnum:]][[:alnum:]_]#[" "$TAB]#(\?|)=*) var=${input%%[ $TAB]#(\?|)=*} val=${input#*=} val=${val##[ $TAB]#} @@ -74,7 +74,7 @@ _make-parseMakefile () { # VARIABLE := value OR VARIABLE ::= value # Evaluated immediately - ([[:alnum:]][[:alnum:]_]#[ $TAB]#:(:|)=*) + ([[:alnum:]][[:alnum:]_]#[" "$TAB]#:(:|)=*) var=${input%%[ $TAB]#:(:|)=*} val=${input#*=} val=${val##[ $TAB]#} @@ -97,7 +97,7 @@ _make-parseMakefile () { ;; # Include another makefile - (${~incl} *) + (${~incl}" "*) local f=${input##${~incl} ##} if [[ $incl == '.include' ]] then diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index ce5852453..1e99ac013 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -23,7 +23,7 @@ local _tar_cmd tf tmp tmpb del index if _pick_variant gnu=GNU unix --version; then case "$($service --version)" in - (tar \(GNU tar\) (#b)([0-9.-]##)*) + ("tar (GNU tar) "(#b)([0-9.-]##)*) autoload -z is-at-least is-at-least 1.14.91 "$match[1]" || _cmd_variant[$service]="gnu-old" ;; diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 22d2aaeba..423563c0d 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -25,7 +25,7 @@ return 1 _call_whatis() { case "$(whatis --version)" in - (whatis from *) + ("whatis from "*) local -A args zparseopts -D -A args s: r: apropos "${args[-r]:-"$@"}" | fgrep "($args[-s]" diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr index 9d9323c69..b0851569e 100644 --- a/Completion/X/Command/_xrandr +++ b/Completion/X/Command/_xrandr @@ -51,7 +51,7 @@ _arguments -C \ case $state in value) case $words[CURRENT-1] in - (scaling* mode) + (scaling*" mode") _description value expl "output property 'scaling mode'" compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0 ;; -- cgit 1.4.1