diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2017-09-12 23:22:34 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2017-09-12 23:22:34 +0200 |
commit | 4aaf06e6678dcead65d7226bd6bde3cffeb2cb2e (patch) | |
tree | 5c8e2ac2c9a85e2e6568aed7120372e6efa074ac /Completion/Base/Utility/_regex_words | |
parent | f33de64abf57611e59df72da230f3d0d6760c4c5 (diff) | |
parent | 6ff4787e830f8edb3a7e32490a88a131e4b62f7f (diff) | |
download | zsh-4aaf06e6678dcead65d7226bd6bde3cffeb2cb2e.tar.gz zsh-4aaf06e6678dcead65d7226bd6bde3cffeb2cb2e.zip |
Merge tag 'zsh-5.4.2' into debian
Release 5.4.2
Diffstat (limited to 'Completion/Base/Utility/_regex_words')
-rw-r--r-- | Completion/Base/Utility/_regex_words | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Completion/Base/Utility/_regex_words b/Completion/Base/Utility/_regex_words index 62c2491bb..90b4a9735 100644 --- a/Completion/Base/Utility/_regex_words +++ b/Completion/Base/Utility/_regex_words @@ -1,6 +1,6 @@ #autoload -local opt OPTARG +local opt OPTARG matches end local term=$'\0' while getopts "t:" opt; do @@ -31,19 +31,22 @@ fi integer i local -a wds +if [[ $term = $'\0' ]]; then + matches=":${tag}:${desc}:(( " + end="))" +else + matches=":${tag}:${desc}:_values -s ${(q)term} ${(q)desc}" +fi + for (( i = 1; i <= $#; i++ )); do wds=(${(s.:.)argv[i]}) reply+=(/${wds[1]//\**/"[^$term]#"}"$term"/) if [[ $term = $'\0' ]]; then - reply+=(":${tag}:${desc}:(( ${wds[1]//\*}:${wds[2]//(#m)[: \(\)]/\\$MATCH} ))") + matches+="${wds[1]//\*}${wds[2]:+\\:${wds[2]//(#m)[: \(\)]/\\$MATCH}} " else - reply+=(":${tag}:${desc}:_values -s ${(q)term} ${(q)desc} \ -${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]") + matches+=" ${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]" fi eval "reply+=($wds[3])" - if (( $i == $# )); then - reply+=(\)) - else - reply+=(\|) - fi + reply+=(\|) done +reply+=( /'[]'/ "${matches}${end}" \) ) |