about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-13 11:13:41 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-13 11:13:55 +0200
commit03241e50b00858c4ebd285cadc1abfcb965f25ce (patch)
treecb234e97df7f568f08ce6e2a9cd694bc5bd4bdd4 /Completion
parent2d14c085b761c71e35cc362f87cd4fecbc8e0676 (diff)
downloadzsh-03241e50b00858c4ebd285cadc1abfcb965f25ce.tar.gz
zsh-03241e50b00858c4ebd285cadc1abfcb965f25ce.tar.xz
zsh-03241e50b00858c4ebd285cadc1abfcb965f25ce.zip
33438: use the new way of splitting strings with a dynamic separator
from 33423 and quote separators where needed
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Utility/_sequence22
1 files changed, 11 insertions, 11 deletions
diff --git a/Completion/Base/Utility/_sequence b/Completion/Base/Utility/_sequence
index 391e5f78f..f52955f46 100644
--- a/Completion/Base/Utility/_sequence
+++ b/Completion/Base/Utility/_sequence
@@ -7,11 +7,11 @@
 # -s sep : specify separator [defaults to comma]
 # -d     : duplicate values allowed
 
-local curcontext="$curcontext" nm="$compstate[nmatches]" pre nosep minus
+local curcontext="$curcontext" nm="$compstate[nmatches]" pre qsep nosep minus
 local -a sep num pref suf end uniq dedup
 
 zparseopts -D -a opts s:=sep n:=num p:=pref i:=pref P:=pref I:=suf S:=suf q=suf r:=suf R:=suf C:=cont d=uniq M: J: X: x:
-(( $#cont )) && curcontext="$curcontext%:*}:$cont[2]"
+(( $#cont )) && curcontext="${curcontext%:*}:$cont[2]"
 (( $#sep )) || sep[2]=,
 
 if (( $+suf[(r)-S] )); then
@@ -19,20 +19,20 @@ if (( $+suf[(r)-S] )); then
   (( $#end )) && compset -S ${end}\* && suf=() && nosep=1
 fi
 
+qsep="${sep[2]}"
+compquote -p qsep
 if (( ! $#uniq )); then
   (( $+pref[(r)-P] )) && pre="${(q)pref[pref[(i)-P]+1]}"
-  typeset -T unique="${PREFIX#$pre}" uniq $sep[2]
-  dedup=( ${(q)uniq[1,-2]} )
-  unique="${SUFFIX}"
-  dedup+=( ${(q)uniq[2,-1]} )
+  dedup=( "${(@)${(@ps.$qsep.)PREFIX#$pre}[1,-2]}" "${(@)${(@ps.$qsep.)SUFFIX}[2,-1]}" )
+  [[ -n $compstate[quoting] ]] || dedup=( ${(Q)dedup} )
 fi
 
-if (( ! $#num )) || (( num[2] > 1 )) && ! compset -P $(( num[2] - 1 )) \*$sep[2]; then
-  (( nosep )) || suf=( -S $sep[2] -r "$end[1]${sep[2][1]} \t\n\-" )
-  compset -S ${sep[2]}\* && suf=()
-  compset -P \*$sep[2] && pref=()
-else
+if (( $#num )) && compset -P $(( num[2] - 1 )) \*${(q)qsep}; then
   pref=()
+else
+  (( ! nosep && (!$#num || num[2] > 1) )) && suf=( -S ${qsep} -r "$end[1]${(q)qsep[1]} \t\n\-" )
+  compset -S ${(q)qsep}\* && suf=()
+  compset -P \*${(q)qsep} && pref=()
 fi
 
 (( minus = argv[(ib:2:)-] ))