zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Yuri D'Elia <wavexx@thregr.org>
Cc: Zsh workers <zsh-workers@zsh.org>
Subject: Re: widget special PREFIX variable and cursor position with complete_in_word
Date: Thu, 27 Feb 2014 00:00:22 +0100	[thread overview]
Message-ID: <19706.1393455622@thecus.kiddle.eu> (raw)
In-Reply-To: <lekvso$udp$1@ger.gmane.org>

Yuri D'Elia wrote:
> On 02/26/2014 09:15 AM, Yuri D'Elia wrote:
> > I also noticed so far that it fails for = like you said, and # too.

# works fine in my testing. As do < and > but it is probably wise to
quote them anyway.

> It occurred to me that maybe = is incorrectly used literally for tokenization inside complist.
> Could somebody look if the string is tokenized correctly?

You're right. The complist code is splitting on =. With the following
patch, the = can be matched. This allows a \= or plain = if it is
inside (...). Any thoughts on if that's right?

Oliver

diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index b852ee9..5e5ba9f 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -383,12 +383,25 @@ getcoldef(char *s)
     } else if (*s == '=') {
 	char *p = ++s, *t, *cols[MAX_POS];
 	int ncols = 0;
+	int nesting = 0;
 	Patprog prog;
 
 	/* This is for a pattern. */
 
-	while (*s && *s != '=')
-	    s++;
+	while (*s && (nesting || *s != '=')) {
+	    switch (*s++) {
+		case '\\':
+		    if (*s)
+			s++;
+		    break;
+		case '(':
+		    nesting++;
+		    break;
+		case ')':
+		    nesting--;
+		    break;
+	    }
+	}
 	if (!*s)
 	    return s;
 	*s++ = '\0';


       reply	other threads:[~2014-02-27  0:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ldgnl5$fo8$1@ger.gmane.org>
     [not found] ` <140212214707.ZM25929@torch.brasslantern.com>
     [not found]   ` <ldii13$jg7$1@ger.gmane.org>
     [not found]     ` <140213092531.ZM26966@torch.brasslantern.com>
     [not found]       ` <ldj21h$9dj$1@ger.gmane.org>
     [not found]         ` <140213223438.ZM27375@torch.brasslantern.com>
     [not found]           ` <13128.1392379014@thecus.kiddle.eu>
     [not found]             ` <ldl3u8$302$1@ger.gmane.org>
     [not found]               ` <13979.1392388765@thecus.kiddle.eu>
     [not found]                 ` <ldlddn$s7r$1@ger.gmane.org>
     [not found]                   ` <15748.1392413785@thecus.kiddle.eu>
     [not found]                     ` <ldsqrp$ndo$1@ger.gmane.org>
     [not found]                       ` <12657.1392655814@thecus.kiddle.eu>
     [not found]                         ` <ldtice$ntg$1@ger.gmane.org>
     [not found]                           ` <16810.1392737023@thecus.kiddle.eu>
     [not found]                             ` <le00gb$rfp$1@ger.gmane.org>
     [not found]                               ` <19322.1392746842@thecus.kiddle.eu>
     [not found]                                 ` <le0d7h$al$1@ger.gmane.org>
     [not found]                                   ` <12895.1393360892@thecus.kiddle.eu>
     [not found]                                     ` <lek7vc$tdt$1@ger.gmane.org>
     [not found]                                       ` <lekvso$udp$1@ger.gmane.org>
2014-02-26 23:00                                         ` Oliver Kiddle [this message]
2014-02-27 11:20                                           ` Yuri D'Elia
     [not found]                                     ` <lek81q$tdt$2@ger.gmane.org>
2014-02-27 15:02                                       ` PATCH: " Oliver Kiddle
2014-02-27 17:02                                         ` Yuri D'Elia

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=19706.1393455622@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=wavexx@thregr.org \
    --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).