Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion regex handling
- X-seq: zsh-workers 23198
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: completion regex handling
- Date: Tue, 27 Feb 2007 20:35:21 +0000
- In-reply-to: <070227084604.ZM13253@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200702252237.l1PMb7Pw012255@xxxxxxxxxxxxxxxxx> <070226001857.ZM8988@xxxxxxxxxxxxxxxxxxxxxx> <20070227124105.8208c36c.pws@xxxxxxx> <070227084604.ZM13253@xxxxxxxxxxxxxxxxxxxxxx>
On Tue, 27 Feb 2007 08:46:04 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Feb 27, 12:41pm, Peter Stephenson wrote:
> }
> } _values is doing something weird [traditional pause for amazed cries to die
> } away] with the separator. It gets it with compvalues -s sep near the top,
> } then further down there's this:
> }
> } if [[ ${#noargs}+${#args}+${#opts} -ne 1 ]] && compvalues -s sep; then
> } sep=( "-qS" "$sep" )
> } else
> } sep=()
> } fi
>
> That all appears to date back to zsh-workers/8219 when Sven first added
> the compvalues call. SourceForge CVS won't help because it doesn't go
> back that far. Then look at workers/14257. Could Sven have missed a
> spot where he needed to make a change? Also, perhaps some of those calls
> to "compvalues -s sep" should (or at least could) be changed to instead
> test (( $+sep )) or something?
Unfortunately
fn() { local sep; print $+sep; }
fn
prints 1. I can't see any good reason to ignore a separator that's been
supplied. I'm going to commit the following and see what breaks.
Playing with dd and parameter subscript completions suggests not a great
deal, at least.
I'm sure the quoting of the argument to _values is wrong in _regex_words
is wrong in some way, and it's certainly inconsistent with the other
branch.
Index: Completion/Base/Utility/_regex_words
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_regex_words,v
retrieving revision 1.1
diff -u -r1.1 _regex_words
--- Completion/Base/Utility/_regex_words 25 Feb 2007 22:44:52 -0000 1.1
+++ Completion/Base/Utility/_regex_words 27 Feb 2007 20:32:30 -0000
@@ -31,9 +31,8 @@
if [[ $term = $'\0' ]]; then
reply+=(":${tag}:${desc}:(( ${wds[1]//\*}:${wds[2]//(#m)[: \(\)]/\\$MATCH} ))")
else
- # HERE: we should add the terminator instead of a space, but
- # there doesn't appear to be an easy way of doing that.
- reply+=(":${tag}:${desc}:(( ${wds[1]//\*}${term//(#m)[: \(\)]/\\$MATCH}:${wds[2]//(#m)[: \(\)]/\\$MATCH} ))")
+ reply+=(":${tag}:${desc}:_values -s ${(q)term} ${(q)desc} \
+${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]")
fi
eval "reply+=($wds[3])"
if (( $i == $# )); then
Index: Completion/Base/Utility/_values
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_values,v
retrieving revision 1.8
diff -u -r1.8 _values
--- Completion/Base/Utility/_values 16 Apr 2002 07:55:49 -0000 1.8
+++ Completion/Base/Utility/_values 27 Feb 2007 20:32:30 -0000
@@ -50,7 +50,7 @@
fi
else
compvalues -d descr
- if [[ ${#noargs}+${#args}+${#opts} -ne 1 ]] && compvalues -s sep; then
+ if compvalues -s sep; then
sep=( "-qS" "$sep" )
else
sep=()
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author