summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Completer/_expand_alias5
-rw-r--r--Completion/Base/Core/_description16
-rw-r--r--Completion/Unix/Command/_git11
-rw-r--r--Completion/Unix/Command/_rm10
-rw-r--r--Completion/X/Command/_x_utils2
5 files changed, 24 insertions, 20 deletions
diff --git a/Completion/Base/Completer/_expand_alias b/Completion/Base/Completer/_expand_alias
index 8848e668d..8240e4162 100644
--- a/Completion/Base/Completer/_expand_alias
+++ b/Completion/Base/Completer/_expand_alias
@@ -1,7 +1,7 @@
 #compdef -K _expand_alias complete-word \C-xa
 
 local word expl tmp pre sel what
-local -a tmpa
+local -a tmpa suf
 
 eval "$_comp_setup"
 
@@ -58,7 +58,8 @@ if [[ -n $tmp ]]; then
       tmp="\\$tmp"
     fi
   fi
-  $pre _wanted aliases expl alias compadd -UQ -- ${tmp%%[[:blank:]]##}
+  zstyle -T ":completion:${curcontext}:" add-space || suf=( -S '' )
+  $pre _wanted aliases expl alias compadd -UQ "$suf[@]" -- ${tmp%%[[:blank:]]##}
 elif (( $#pre )) && zstyle -t ":completion:${curcontext}:" complete; then
   $pre _aliases -s "$sel" -S ''
 else
diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description
index 3d993271c..304c747a6 100644
--- a/Completion/Base/Core/_description
+++ b/Completion/Base/Core/_description
@@ -47,17 +47,19 @@ if [[ -z "$_comp_no_ignore" ]]; then
   zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
     _comp_ignore=()
 
-  zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
+  if zstyle -s ":completion:${curcontext}:$1" ignore-line hidden; then
+    local -a qwords
+    qwords=( ${words//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} )
     case "$hidden" in
-    true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" ${(q)"${words[@]}"} );;
-    current)       _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );;
+    true|yes|on|1) _comp_ignore+=( $qwords );;
+    current)       _comp_ignore+=( $qwords[CURRENT] );;
     current-shown)
 	    [[ "$compstate[old_list]" = *shown* ]] &&
-            _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );;
-    other)         _comp_ignore=( "$_comp_ignore[@]"
-                                  "${(@q)words[1,CURRENT-1]}"
-				  "${(@q)words[CURRENT+1,-1]}" );;
+            _comp_ignore+=( $qwords[CURRENT] );;
+    other)         _comp_ignore+=( $qwords[1,CURRENT-1]
+				   $qwords[CURRENT+1,-1] );;
     esac
+  fi
 
   # Ensure the ignore option is first so we can override it
   # for fake-always.
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index a2cbf74d0..b082bb050 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5526,9 +5526,12 @@ __git_remote_branch_names_noprefix () {
 __git_commits () {
   # TODO: deal with things that __git_heads and __git_tags has in common (i.e.,
   # if both exists, they need to be completed to heads/x and tags/x.
+  local -a sopts ropt
+  zparseopts -E -a sopts S: r:=ropt R: q
+  sopts+=( $ropt:q )
   _alternative \
-    'heads::__git_heads' \
-    'commit-tags::__git_commit_tags' \
+    "heads::__git_heads $sopts" \
+    "commit-tags::__git_commit_tags $sopts" \
     'commit-objects::__git_commit_objects'
 }
 
@@ -5595,10 +5598,12 @@ __git_commits2 () {
 
 (( $+functions[__git_commit_ranges] )) ||
 __git_commit_ranges () {
+  local -a suf
   if compset -P '*..(.|)'; then
     __git_commits $*
   else
-    __git_commits $* -qS ..
+    compset -S '..*' || suf=( -qS .. -r '.@~ ^:' )
+    __git_commits $* $suf
   fi
 }
 
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 20f44afc5..1f156c481 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -32,13 +32,9 @@ _arguments -C $opts \
 
 case $state in
   (file)
-    declare -a ignored
-    ignored=()
-    ((CURRENT > 1)) &&
-      ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
-    ((CURRENT < $#line)) &&
-      ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
-    _files -F ignored && ret=0
+    line[CURRENT]=()
+    line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} )
+    _files -F line && ret=0
     ;;
 esac
 
diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils
index 0ff0cf268..9448fd3df 100644
--- a/Completion/X/Command/_x_utils
+++ b/Completion/X/Command/_x_utils
@@ -69,7 +69,7 @@ xev)
     '-rv'
   ;;
 xhost)
-  local expl type ret=1 tmp match
+  local type tmp match
 
   if compset -P '-'; then
     tmp=(${(f)"$(xhost)"})