summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_git11
-rw-r--r--Completion/Unix/Command/_rm10
2 files changed, 11 insertions, 10 deletions
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