Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Re: cvs completion does not support partial path completion



Bart Schaefer wrote:

> ...
> 
> } If you don't want that, we could probably special-case that single space
> } to mean to not pass a -X.
> 
> Either that, or strip all leading/trailing whitespace from the message,
> and ignore empty messages.

Yes, that's better.


Bye
  Sven

Index: Completion/Base/Core/_description
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_description,v
retrieving revision 1.1
diff -u -r1.1 _description
--- Completion/Base/Core/_description	2001/04/02 11:03:01	1.1
+++ Completion/Base/Core/_description	2001/05/08 08:44:49
@@ -9,7 +9,8 @@
   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 @@
 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
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.121
diff -u -r1.121 compsys.yo
--- Doc/Zsh/compsys.yo	2001/04/27 09:12:34	1.121
+++ Doc/Zsh/compsys.yo	2001/05/08 08:44:52
@@ -2879,7 +2879,9 @@
 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 @@
 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 @@
 
 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).

-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author