about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Unix/Command/_rm7
2 files changed, 8 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b0f2a984..024ff2521 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-11-11  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* Greg Klanderman: 27391: Completion/Unix/Command/_rm:
+	 fix ignored (duplicate) file names
+	
 	* users/14548: Src/Modules/termcap.c: prevent libtermcap from
 	exiting on an unknown terminal type
 
@@ -11,9 +14,6 @@
 
 2009-11-10  Barton E. Schaefer  <schaefer@zsh.org>
 
-	* Greg Klanderman: 27377 (slightly tweaked):
-	Completion/Unix/Command/_rm: fix ignored (duplicate) file names
-
 	* 27368, 27369: FEATURES: replace one incorrect example with two
 	correct ones
 
@@ -12336,5 +12336,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4809 $
+* $Revision: 1.4810 $
 *****************************************************
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 21b10d3f6..20f44afc5 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -33,10 +33,11 @@ _arguments -C $opts \
 case $state in
   (file)
     declare -a ignored
-    if ((CURRENT > 1)); then
-      ignored=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    ignored=()
+    ((CURRENT > 1)) &&
+      ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    ((CURRENT < $#line)) &&
       ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
-    fi
     _files -F ignored && ret=0
     ;;
 esac