about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-06-19 19:54:44 +0200
committerOliver Kiddle <opk@zsh.org>2015-06-19 19:54:44 +0200
commitb2de9b518e54c73b2832ad8e24d536f5c05be985 (patch)
treeef35a6e27bdde5ad7db169a4f1115ade78ecc2c7
parentaea461e542ba99182b7ab36f79b230d185258ec7 (diff)
downloadzsh-b2de9b518e54c73b2832ad8e24d536f5c05be985.tar.gz
zsh-b2de9b518e54c73b2832ad8e24d536f5c05be985.tar.xz
zsh-b2de9b518e54c73b2832ad8e24d536f5c05be985.zip
35527: use list-separator style in cases where separator was hardcoded
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Type/_email_addresses5
-rw-r--r--Completion/Zsh/Command/_fc19
-rw-r--r--Completion/Zsh/Command/_zpty7
4 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 0151d9946..16daaab8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-06-19  Oliver Kiddle  <opk@zsh.org>
 
+	* 35527: Completion/Unix/Type/_email_addresses,
+	Completion/Zsh/Command/_fc, Completion/Zsh/Command/_zpty:
+	use list-separator style in cases where separator was hardcoded
+
 	* 35528: Completion/Unix/Type/_pids: allow for IPREFIX
 
 2015-06-18  Oliver Kiddle  <opk@zsh.org>
diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses
index 926e8b4e3..7d5c942de 100644
--- a/Completion/Unix/Type/_email_addresses
+++ b/Completion/Unix/Type/_email_addresses
@@ -88,7 +88,7 @@ _email-local() {
 _email_addresses() {
   local -a plugins reply list args
   local -A opts files
-  local plugin rcfile muttrc expl ret fret
+  local plugin rcfile muttrc expl sep ret fret
 
   local __specialx='][()<>@,;:\\".'
   local __spacex=" 	"				# Space, tab
@@ -159,7 +159,8 @@ _email_addresses() {
 
 	  if (( fret == 300 )); then
 	    if (( ! $+opts[-c] )) && [[ $opts[-n] = $plugin ]]; then
-	      zformat -a list ' -- ' "${reply[@]}"
+	      zstyle -s ":completion:${curcontext}:$curtag" list-separator sep || sep=--
+	      zformat -a list " $sep " "${reply[@]}"
 	      _wanted mail-aliases expl 'alias' compadd "$@" \
 		  -d list - ${reply%%:*} && ret=0
 	    else
diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc
index 15892440b..68456cc3d 100644
--- a/Completion/Zsh/Command/_fc
+++ b/Completion/Zsh/Command/_fc
@@ -1,7 +1,7 @@
 #compdef fc history r
 
 local curcontext="$curcontext" state state_descr line ret=1
-local list events num cmd
+local events num cmd sep
 typeset -A opt_args
 local fc_common fc_hist fc_r
 
@@ -67,21 +67,20 @@ case $service in
 esac
 
 if [[ -n $state ]]; then
+  zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
   if [[ -z ${line:#*=*} ]] && compset -P '*='; then
     _message -e replacements 'replacement'
   elif [[ -prefix [0-9] ]]; then
-    events=( ${(ps.\0.)"$(printf '%s:%s\0' ${(kv)history})"} )
-    zformat -a list " -- " "$events[@]"
-    _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld list - \
-        "${events[@]%%:*}"
+    events=( ${(0)"$(printf "%-${#HISTNO}.${#HISTNO}s $sep %s\0" "${(kv)history[@]}")"} )
+    _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld events - \
+        "${events[@]%% *}"
   elif [[ -prefix - ]]; then
-    for num cmd in ${(kv)history}; do
+    for num cmd in "${(kv@)history}"; do
       (( num=num - HISTNO ))
-      events+=( $num:$cmd )
+      events+=( "${(r.1+$#HISTNO.)num} $sep $cmd" )
     done
-    zformat -a list " -- " "$events[@]"
-    _wanted -2V events expl "$state_descr" compadd -ld list - \
-        "${events[@]%%:*}"
+    _wanted -2V events expl "$state_descr" compadd -ld events - \
+        "${events[@]%% *}"
   else
     _wanted events expl "$state_descr" compadd -S '' - \
         ${${history%%[=[:IFS:]]*}:#[0-9-]*} || _guard "[0-9]#" event
diff --git a/Completion/Zsh/Command/_zpty b/Completion/Zsh/Command/_zpty
index ef4ac4bb1..99251aa0a 100644
--- a/Completion/Zsh/Command/_zpty
+++ b/Completion/Zsh/Command/_zpty
@@ -1,6 +1,6 @@
 #compdef zpty
 
-local state line list names expl curcontext="$curcontext"
+local state line list names expl sep curcontext="$curcontext"
 typeset -A opt_args
 
 _arguments -C -s -S \
@@ -50,8 +50,9 @@ if [[ $state = name ]]; then
   fi
   list=( ${${(f)"$(zpty)"}#*\) } )
   names=( ${list%%:*} )
-  if zstyle -T ":completion:${curcontext}" verbose; then
-    zformat -a list ' --' ${${(f)"$(zpty)"}#*\) }
+  if zstyle -T ":completion:${curcontext}:" verbose; then
+    zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
+    zformat -a list " $sep" ${${(f)"$(zpty)"}#*\) }
     _wanted names expl 'zpty command name' compadd -d list -a names
   else
     _wanted names expl 'zpty command name' compadd -a names