zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: Dynamic named directories and completion
Date: Mon, 26 Feb 2018 21:22:56 +0000	[thread overview]
Message-ID: <20180226212256.58462441@ntlworld.com> (raw)
In-Reply-To: <20180226200821.0ef8ecbb@ntlworld.com>

On Mon, 26 Feb 2018 20:08:21 +0000
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > I feel like expand-or-complete should work too, but as long as the
> > _expand patch makes it into the final code I'm happy.
> 
> Yes, me too, particularly now Mikael has pointed out ^X*: I'll look
> at this separately.

I think this works.

What was happening was as a last search for something to expand the code
looked wildcards, and the square brackets triggered that.

pws

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index caeef76..22c3812 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -456,6 +456,7 @@ checkparams(char *p)
 static int
 cmphaswilds(char *str)
 {
+    char *ptr;
     if ((*str == Inbrack || *str == Outbrack) && !str[1])
 	return 0;
 
@@ -465,6 +466,14 @@ cmphaswilds(char *str)
     if (str[0] == '%' && str[1] ==Quest)
 	str += 2;
 
+    /*
+     * In ~[foo], the square brackets are not wild cards.
+     * This test matches the master one in filesubstr().
+     */
+    if (*str == Tilde && str[1] == Inbrack &&
+	(ptr = strchr(str+2, Outbrack)))
+	str = ptr + 1;
+
     for (; *str;) {
 	if (*str == String || *str == Qstring) {
 	    /* A parameter expression. */


  reply	other threads:[~2018-02-26 21:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 22:54 Scott Frazer
2018-02-23  0:29 ` [RFC PATCH] _path_files: teach zsh_directory_name Takeshi Banse
2018-02-23  1:19   ` _path_files: fix copy paste error Takeshi Banse
2018-02-23  1:30   ` _path_files: fix copy paste error (2/2) Takeshi Banse
2018-02-23  8:01 ` Dynamic named directories and completion Vincent Bernat
2018-02-23 14:41   ` Scott Frazer
2018-02-23 15:02     ` Takeshi Banse
2018-02-23 14:42   ` Scott Frazer
2018-02-24 19:34     ` Peter Stephenson
2018-02-24 19:49       ` Mikael Magnusson
2018-02-24 20:12         ` Peter Stephenson
2018-02-26 14:31           ` Scott Frazer
2018-02-26 13:53       ` Scott Frazer
2018-02-26 14:47         ` Peter Stephenson
2018-02-26 16:44           ` Scott Frazer
2018-02-26 20:08             ` Peter Stephenson
2018-02-26 21:22               ` Peter Stephenson [this message]
2018-02-26 17:49           ` Mikael Magnusson
2018-02-26 17:55             ` Peter Stephenson

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=20180226212256.58462441@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@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).