Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: brace in alias name and compsys



On Sun, 15 Dec 2013 20:38:21 +0000
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sun, 15 Dec 2013 11:52:36 -0800
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author