about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2009-11-10 22:17:02 +0000
committerBart Schaefer <barts@users.sourceforge.net>2009-11-10 22:17:02 +0000
commitf91f79c4571adb3f646613fe0561c497bdea2955 (patch)
tree0e48cf68da4c61b552d00850402203b1c85b5ed7
parentb159a6bba22f78ec4dad1436572b08d7902adb51 (diff)
downloadzsh-f91f79c4571adb3f646613fe0561c497bdea2955.tar.gz
zsh-f91f79c4571adb3f646613fe0561c497bdea2955.tar.xz
zsh-f91f79c4571adb3f646613fe0561c497bdea2955.zip
Greg Klanderman: 27377 (slightly tweaked): fix ignored (duplicate) file names
-rw-r--r--Completion/Unix/Command/_rm7
1 files changed, 5 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 815bbbdf8..21b10d3f6 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -5,7 +5,7 @@ args=(
   '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]'
   '(-I --interactive)-i[prompt before every removal]'
   '(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]'
-  '*:files:->file'
+  '*::files:->file'
 )
 if _pick_variant gnu=gnu unix --help; then
   opts+=(-S)
@@ -33,7 +33,10 @@ _arguments -C $opts \
 case $state in
   (file)
     declare -a ignored
-    ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    if ((CURRENT > 1)); then
+      ignored=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+      ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    fi
     _files -F ignored && ret=0
     ;;
 esac