about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-01-03 18:26:56 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-01-03 18:26:56 +0000
commitae0bba2bfca67c49e7e31a44ca7b53c85bf020d5 (patch)
tree333049e139fa6158b0c2c2148a3e9dd3d24a16f8
parent96de4d0740485b70e8e6210fd47e83c6a9bece0e (diff)
downloadzsh-ae0bba2bfca67c49e7e31a44ca7b53c85bf020d5.tar.gz
zsh-ae0bba2bfca67c49e7e31a44ca7b53c85bf020d5.tar.xz
zsh-ae0bba2bfca67c49e7e31a44ca7b53c85bf020d5.zip
16397: use nul instead of colon to avoid problems with _value: functions
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Widget/_complete_help37
2 files changed, 19 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index fb603a5ed..259ce6d54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-01-03  Oliver Kiddle  <opk@zsh.org>
 
+	* 16397: Completion/Base/Widget/_complete_help: use nul as separator
+	instead of colon to avoid problems with _value:<param> functions
+
 	* 16396: Completion/Unix/Command/_chown: fix argument handling bugs
 
 2002-01-03  Clint Adams  <clint@zsh.org>
diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help
index 69930e105..282956b07 100644
--- a/Completion/Base/Widget/_complete_help
+++ b/Completion/Base/Widget/_complete_help
@@ -14,8 +14,8 @@ _complete_help() {
 
     if [[ "$help_sfuncs[$2]" != *${_f}* ||
           "$help_styles[${2}${_f}]" != *${3}* ]]; then
-      [[ "$help_sfuncs[$2]" != *${_f}* ]] &&
-          help_sfuncs[$2]="${help_sfuncs[$2]}:${_f}"
+
+      [[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
       local _t
 
       case "$1" in
@@ -24,7 +24,7 @@ _complete_help() {
       -h) _t='[assoc]  ';;
       *)  _t='[boolean]';;
       esac
-      help_styles[${2}${_f}]="${help_styles[${2}${_f}]},${_t} ${3}:${_f}"
+      help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
     fi
 
     # No need to call the completers more than once with different match specs.
@@ -43,32 +43,27 @@ _complete_help() {
   trap - EXIT INT
 
   for i in "${(@ok)help_funcs}"; do
-    text="${text}
-tags in context :completion:${i}:"
+    text+=$'\n'"tags in context :completion:${i}:"
     tmp=()
-    for j in "${(@s.:.)help_funcs[$i][2,-1]}"; do
-      tmp=( "$tmp[@]" "${(@s.,.)help_tags[${i}${j}][2,-1]}" )
+    for j in "${(@ps.\0.)help_funcs[$i][2,-1]}"; do
+      tmp+=( "${(@s.,.)help_tags[${i}${j}][2,-1]}" )
     done
     zformat -a tmp '  (' "$tmp[@]"
-    tmp=( '
-    '${^tmp}')' )
-    text="${text}${tmp}"
+    tmp=( $'\n    '${^tmp}')' )
+    text+="${tmp}"
   done
 
   if [[ ${NUMERIC:-1} -ne 1 ]]; then
-    text="$text
-"
+    text+=$'\n'
     for i in "${(@ok)help_sfuncs}"; do
-      text="${text}
-styles in context ${i}"
+      text+=$'\n'"styles in context ${i}"
       tmp=()
-      for j in "${(@s.:.)help_sfuncs[$i][2,-1]}"; do
-        tmp=( "$tmp[@]" "${(@s.,.)help_styles[${i}${j}][2,-1]}" )
+      for j in "${(@ps.\0.)help_sfuncs[$i][2,-1]}"; do
+        tmp+=( "${(@s.,.)help_styles[${i}${j}][2,-1]}" )
       done
       zformat -a tmp '  (' "$tmp[@]"
-      tmp=( '
-    '${^tmp}')' )
-      text="${text}${tmp}"
+      tmp=( $'\n    '${^tmp}')' )
+      text+="${tmp}"
     done
   fi
   compstate[list]='list force'
@@ -83,8 +78,8 @@ _help_sort_tags() {
   if [[ "$help_funcs[$curcontext]" != *${f}* ||
         "$help_tags[${curcontext}${f}]" != *(${(j:|:)~argv})* ]]; then
     [[ "$help_funcs[$curcontext]" != *${f}* ]] &&
-        help_funcs[$curcontext]="${help_funcs[$curcontext]}:${f}"
-    help_tags[${curcontext}${f}]="${help_tags[${curcontext}${f}]},${argv}:${f}"
+        help_funcs[$curcontext]+=$'\0'"${f}"
+    help_tags[${curcontext}${f}]+=",${argv}:${f}"
     comptry "$@"
   fi
 }