about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJun T <takimoto-j@kba.biglobe.ne.jp>2014-02-27 01:32:32 +0900
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-02-26 20:39:11 +0000
commit7d7242405a82332716b5fdba68f32ecabf6349be (patch)
tree3c87dd8cad248b4e8432073953975b197df98e76
parent4149d0ab3e770b4e28b447ecbe6a6b77cecf46dd (diff)
downloadzsh-7d7242405a82332716b5fdba68f32ecabf6349be.tar.gz
zsh-7d7242405a82332716b5fdba68f32ecabf6349be.tar.xz
zsh-7d7242405a82332716b5fdba68f32ecabf6349be.zip
32435: improved quoting for ignore-line completion style
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Base/Core/_description16
-rw-r--r--Completion/Unix/Command/_rm10
3 files changed, 18 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 18c866aa2..e36b1b770 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-26  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Jun T: Completion/Base/Core/_description,
+	Completion/Unix/Command/_rm: improved quoting for ignore-line
+	style.
+
 2014-02-24  Oliver Kiddle <opk@zsh.org>
 
 	* unposted: Doc/Zsh/compsys.yo: fix typo
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/_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