zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: completion regex handling
Date: Tue, 27 Feb 2007 20:35:21 +0000	[thread overview]
Message-ID: <20070227203521.15a9d9d7.p.w.stephenson@ntlworld.com> (raw)
In-Reply-To: <070227084604.ZM13253@torch.brasslantern.com>

On Tue, 27 Feb 2007 08:46:04 -0800
Bart Schaefer <schaefer@brasslantern.com> 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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      reply	other threads:[~2007-02-27 20:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-25 22:37 Peter Stephenson
2007-02-26  8:18 ` Bart Schaefer
2007-02-27 12:41   ` Peter Stephenson
2007-02-27 16:46     ` Bart Schaefer
2007-02-27 20:35       ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070227203521.15a9d9d7.p.w.stephenson@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).