Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: widget special PREFIX variable and cursor position with complete_in_word
- X-seq: zsh-workers 32436
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Yuri D'Elia <wavexx@xxxxxxxxxx>
- Subject: Re: widget special PREFIX variable and cursor position with complete_in_word
- Date: Thu, 27 Feb 2014 00:00:22 +0100
- Cc: Zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1393460739; bh=pKC5CoHViSGqhQwyb27t60Pu5RGQ9BFhsF27suBeL1I=; h=Received:Received:Received:DKIM-Signature:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=DZ1VTFgjUUI0WCz8bTPDd1qd1rlAkJMSAetwujAmRVeQUujkyvQj9sKJrZEDYDRqY6rmtDbVtTMkhMxOa3S6EgBZb+cYOkaZU44kGfc0VrJPX9GEfR4j1Ug4Nwta59iLT+XnKN+kwpNnQT6V+SQfEcqFoaudn/lwMyTa4ELFISk=
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1393460739; bh=pKC5CoHViSGqhQwyb27t60Pu5RGQ9BFhsF27suBeL1I=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=WmuODZtMi++r0CM/fQrJueGfvK7nq8eVROSsnSrQgaqxBS5TiUgSL4Wp+nnj5S0VXt0hz5QETqxGi0AY3Q77ipMQKwTturnQ9YQFWwXErJ0HKzhmlb4JfGeg1C4Dqm5JY0Pkak62YGJfAq6SRWVLFghUa1ODA5caaarRgL90mNs=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; b=3secjHTnaBb7Wlq16WvRfEzQc0pcTdMx8HpXTh+fZ++x9fa/QoG2jFzQfdyeaOZCY3bvFqJMpHNMsBT0DsVNaNrdI8wbyku3MZkXsVRyaZBH8aIdpaOsAou2g1D30cdULYjWiJ7NY2p6YzwgfV9Uvb3qIam38XxuxAI9SLLJ1GA=;
- In-reply-to: <lekvso$udp$1@ger.gmane.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <ldgnl5$fo8$1@ger.gmane.org> <140212214707.ZM25929@torch.brasslantern.com> <ldii13$jg7$1@ger.gmane.org> <140213092531.ZM26966@torch.brasslantern.com> <ldj21h$9dj$1@ger.gmane.org> <140213223438.ZM27375@torch.brasslantern.com> <13128.1392379014@thecus.kiddle.eu> <ldl3u8$302$1@ger.gmane.org> <13979.1392388765@thecus.kiddle.eu> <ldlddn$s7r$1@ger.gmane.org> <15748.1392413785@thecus.kiddle.eu> <ldsqrp$ndo$1@ger.gmane.org> <12657.1392655814@thecus.kiddle.eu> <ldtice$ntg$1@ger.gmane.org> <16810.1392737023@thecus.kiddle.eu> <le00gb$rfp$1@ger.gmane.org> <19322.1392746842@thecus.kiddle.eu> <le0d7h$al$1@ger.gmane.org> <12895.1393360892@thecus.kiddle.eu> <lek7vc$tdt$1@ger.gmane.org> <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';
Messages sorted by:
Reverse Date,
Date,
Thread,
Author