zsh-workers
 help / color / mirror / code / Atom feed
* Re: brace in alias name and compsys
       [not found] ` <131215115236.ZM20467@torch.brasslantern.com>
@ 2013-12-15 20:38   ` Peter Stephenson
  2013-12-15 21:11     ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2013-12-15 20:38 UTC (permalink / raw)
  To: Zsh Hackers' List

On Sun, 15 Dec 2013 11:52:36 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> While we're on the subject, completing after "[" or "[[" in command
> position (no intervening whitespace) incorrectly attempts subscript
> completion.  This appears to be a bug somewhere in the internals,
> because compstate[context] has been set to 'subscript' and there's no
> assignment to that in _complete_debug output.

I think it's something like this.

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e30e0b1..6ed4a0e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1505,7 +1505,11 @@ get_comp_string(void)
 	else
 	    nnb = s;
 	for (tt = s; tt < s + zlemetacs_qsub - wb;) {
-	    if (*tt == Inbrack) {
+	    /*
+	     * Ignore '[' at the start of a command as it's not
+	     * matched by a closing bracket.
+	     */
+	    if (*tt == Inbrack && (tt != s || !lincmd)) {
 		i++;
 		nb = nnb;
 		ne = tt;

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: brace in alias name and compsys
  2013-12-15 20:38   ` brace in alias name and compsys Peter Stephenson
@ 2013-12-15 21:11     ` Peter Stephenson
  2013-12-15 21:13       ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2013-12-15 21:11 UTC (permalink / raw)
  To: Zsh Hackers' List

On Sun, 15 Dec 2013 20:38:21 +0000
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Sun, 15 Dec 2013 11:52:36 -0800
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > While we're on the subject, completing after "[" or "[[" in command
> > position (no intervening whitespace) incorrectly attempts subscript
> > completion.  This appears to be a bug somewhere in the internals,
> > because compstate[context] has been set to 'subscript' and there's no
> > assignment to that in _complete_debug output.
> 
> I think it's something like this.

This is probably better.

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e30e0b1..016cc46 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1504,7 +1504,14 @@ get_comp_string(void)
 	    nnb = s + MB_METACHARLEN(s);
 	else
 	    nnb = s;
-	for (tt = s; tt < s + zlemetacs_qsub - wb;) {
+	tt = s;
+	/*
+	 * Ignore '['s at the start of a command as they're not
+	 * matched by closing brackets.
+	 */
+	while (*tt == Inbrack)
+	    tt++;
+	for (; tt < s + zlemetacs_qsub - wb;) {
 	    if (*tt == Inbrack) {
 		i++;
 		nb = nnb;

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: brace in alias name and compsys
  2013-12-15 21:11     ` Peter Stephenson
@ 2013-12-15 21:13       ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2013-12-15 21:13 UTC (permalink / raw)
  To: Zsh Hackers' List

On Sun, 15 Dec 2013 21:11:19 +0000
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Sun, 15 Dec 2013 20:38:21 +0000
> Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > On Sun, 15 Dec 2013 11:52:36 -0800
> > Bart Schaefer <schaefer@brasslantern.com> wrote:
> > > While we're on the subject, completing after "[" or "[[" in command
> > > position (no intervening whitespace) incorrectly attempts subscript
> > > completion.  This appears to be a bug somewhere in the internals,
> > > because compstate[context] has been set to 'subscript' and there's no
> > > assignment to that in _complete_debug output.
> > 
> > I think it's something like this.
> 
> This is probably better.

Except I need to get it right.

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e30e0b1..2f3cdab 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1504,7 +1504,17 @@ get_comp_string(void)
 	    nnb = s + MB_METACHARLEN(s);
 	else
 	    nnb = s;
-	for (tt = s; tt < s + zlemetacs_qsub - wb;) {
+	tt = s;
+	if (lincmd)
+	{
+	    /*
+	     * Ignore '['s at the start of a command as they're not
+	     * matched by closing brackets.
+	     */
+	    while (*tt == Inbrack)
+		tt++;
+	}
+	for (; tt < s + zlemetacs_qsub - wb;) {
 	    if (*tt == Inbrack) {
 		i++;
 		nb = nnb;

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-15 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20131215073603.GA97197@redoubt.spodhuis.org>
     [not found] ` <131215115236.ZM20467@torch.brasslantern.com>
2013-12-15 20:38   ` brace in alias name and compsys Peter Stephenson
2013-12-15 21:11     ` Peter Stephenson
2013-12-15 21:13       ` Peter Stephenson

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).