about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Core/_description9
-rw-r--r--Doc/Zsh/compsys.yo13
3 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0eef57c47..f204d2e29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2001-05-08  Sven Wischnowsky  <wischnow@zsh.org>
 
+	* 14252: Completion/Base/Core/_description, Doc/Zsh/compsys.yo:
+	empty description means: don't add a -X option
+
 	* 14251: Src/Zle/complist.c, Src/Zle/zle_tricky.c: print
 	space/backspace when reaching the last column while printing
 	descriptions and the like to avoid a cursor positioning bug
diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description
index 2c4232ade..6b4cadfe8 100644
--- a/Completion/Base/Core/_description
+++ b/Completion/Base/Core/_description
@@ -9,7 +9,8 @@ if [[ "$1" = -([12]|)[VJ] ]]; then
   shift
 fi
 
-_lastdescr=( "$_lastdescr[@]" "$3" )
+3="${${3##[[:blank:]]#}%%[[:blank:]]#}"
+[[ -n "$3" ]] && _lastdescr=( "$_lastdescr[@]" "$3" )
 
 zstyle -s ":completion:${curcontext}:$1" group-name gname &&
     [[ -z "$gname" ]] && gname="$1"
@@ -51,7 +52,11 @@ else
 fi
 
 shift 2
-[[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+if [[ -z "$1" && $# -eq 1 ]]; then
+  format=
+elif [[ -n "$format" ]]; then
+  zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+fi
 
 if [[ -n "$gname" ]]; then
   if [[ -n "$format" ]]; then
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index ba7c148c7..7e322aa9b 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2879,7 +2879,9 @@ item(var(n)tt(::)var(message)tt(:)var(action))(
 This describes the var(n)'th normal argument.  The var(message) will be 
 printed above the matches generated and the var(action) says what can
 be completed in this position (see below).  If there are two colons
-before the var(message), this describes an optional argument.
+before the var(message), this describes an optional argument.  If the
+var(message) contains only white space, nothing will be printed above
+the matches unless the action adds an explanation string itself.
 )
 xitem(tt(:)var(message)tt(:)var(action))
 item(tt(::)var(message)tt(:)var(action))(
@@ -3008,7 +3010,8 @@ xitem(tt(:)var(message)tt(:)var(action))
 item(tt(::)var(message)tt(:)var(action))(
 Describes a mandatory argument with one colon, or an optional argument
 with two colons.  As in other forms of var(spec), the var(message) will be
-printed above the matches generated and the var(action) says what can be
+printed above the matches generated (unless it contains only white
+space, see above) and the var(action) says what can be
 completed in this position.
 )
 xitem(tt(:*)var(pattern)tt(:)var(message)tt(:)var(action))
@@ -3460,7 +3463,11 @@ function which tests some more styles.
 
 The string returned by the tt(format) style (if any) will be modified so
 that the sequence `tt(%d)' is replaced by the var(descr) given as the third
-argument.  If tt(_description) is called with more than three arguments,
+argument without any leading or trailing white space.  If, after
+removing the white space, the var(descr) is the empty string, the format
+style will not be used and the options put into the var(name) array will
+not contain an explantion string to be displayed above the matches.If
+tt(_description) is called with more than three arguments,
 the additional var(specs) should be of the form `var(char)tt(:)var(str)'
 and every appearance of `tt(%)var(char)' in the format string will be
 replaced by var(string).