summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2017-08-18 13:02:18 +0200
committerOliver Kiddle <opk@zsh.org>2017-08-18 13:02:18 +0200
commit9dee8e00b9a0807f27d08861df95f965264e2e26 (patch)
tree6be4982c47d7c01bb00bac414f2ec53c8e3f25da /Completion/Base
parent620b7d61ab918fce883c8f5bf4fcd93a5365de48 (diff)
downloadzsh-9dee8e00b9a0807f27d08861df95f965264e2e26.tar.gz
zsh-9dee8e00b9a0807f27d08861df95f965264e2e26.tar.xz
zsh-9dee8e00b9a0807f27d08861df95f965264e2e26.zip
41563: fix completion description alignment with _regex_words
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Utility/_regex_words21
1 files changed, 12 insertions, 9 deletions
diff --git a/Completion/Base/Utility/_regex_words b/Completion/Base/Utility/_regex_words
index 62c2491bb..90b4a9735 100644
--- a/Completion/Base/Utility/_regex_words
+++ b/Completion/Base/Utility/_regex_words
@@ -1,6 +1,6 @@
 #autoload
 
-local opt OPTARG
+local opt OPTARG matches end
 local term=$'\0'
 
 while getopts "t:" opt; do
@@ -31,19 +31,22 @@ fi
 integer i
 local -a wds
 
+if [[ $term = $'\0' ]]; then
+  matches=":${tag}:${desc}:(( "
+  end="))"
+else
+  matches=":${tag}:${desc}:_values -s ${(q)term} ${(q)desc}"
+fi
+
 for (( i = 1; i <= $#; i++ )); do
   wds=(${(s.:.)argv[i]})
   reply+=(/${wds[1]//\**/"[^$term]#"}"$term"/)
   if [[ $term = $'\0' ]]; then
-    reply+=(":${tag}:${desc}:(( ${wds[1]//\*}:${wds[2]//(#m)[: \(\)]/\\$MATCH} ))")
+    matches+="${wds[1]//\*}${wds[2]:+\\:${wds[2]//(#m)[: \(\)]/\\$MATCH}} "
   else
-    reply+=(":${tag}:${desc}:_values -s ${(q)term} ${(q)desc} \
-${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]")
+    matches+=" ${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]"
   fi
   eval "reply+=($wds[3])"
-  if (( $i == $# )); then
-    reply+=(\))
-  else
-    reply+=(\|)
-  fi
+  reply+=(\|)
 done
+reply+=( /'[]'/ "${matches}${end}" \) )