zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: [PATCH] Quote components before using it is pattern
Date: Sat, 21 Aug 2010 10:12:09 -0700	[thread overview]
Message-ID: <100821101209.ZM31841@torch.brasslantern.com> (raw)
In-Reply-To: <100821095410.ZM31747@torch.brasslantern.com>

On Aug 21,  9:54am, Bart Schaefer wrote:
}
} As has come up elsewhere, the problem is that ${(q)...} is a bit too
} aggressive for the purpose to which it is being put.  We need to quote
} pattern characters in tmp1, but not other characters like spaces.

Or maybe we're just being too clever trying to construct an (...|...)
pattern and the right thing is just to not quote anything:

Index: Completion/Base/Utility/_multi_parts
===================================================================
diff -c -r1.6 _multi_parts
--- _multi_parts	4 Nov 2008 04:47:52 -0000	1.6
+++ _multi_parts	21 Aug 2010 17:09:09 -0000
@@ -127,7 +127,8 @@
 	return
       fi
     elif (( $#tmp1 )); then
-      local ret=1
+      local ret=1 tt
+      local -a mm
 
       # More than one match. First we get all strings that match the
       # rest from the line.
@@ -144,7 +145,11 @@
 	SUFFIX="$suf"
       fi
 
-      matches=( "${(@M)matches:#(${(j:|:)~${(q)tmp1}})*}" )
+      for tt in $tmp1
+      do
+        mm+=( "${(@M)matches:#$tt*}" )
+      done
+      matches=( $mm )
 
       if ! zstyle -t ":completion:${curcontext}:" expand suffix ||
          [[ -n "$menu" || -z "$compstate[insert]" ]]; then


  parent reply	other threads:[~2010-08-21 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13 23:01 Jörg Sommer
2008-10-14 15:01 ` Jörg Sommer
2010-08-21 12:46   ` Mikael Magnusson
2010-08-21 16:54     ` Bart Schaefer
2010-08-21 17:04       ` Mikael Magnusson
2010-08-21 17:12       ` Bart Schaefer [this message]
2010-08-21 17:25         ` Mikael Magnusson

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=100821101209.ZM31841@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).