On Dec 25, 12:01pm, Frank Terbeck wrote:
}
} I git-bisected this to:
} 
} [568e0db7a964feefa45061967d0c7079a0e59c1e]
}   31611: attempt to fix crash completing redirection in do loop
} 
} This is in zle_tricky.c, so naturally I'm afraid to touch it. :)

I think this is the right thing, but it would be helpful if someone
can also check that the redirection issue has not regressed.  (There
are no tests of command completion in Y01, so I'm not sure how to
add a regression test for these.)

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 25f09c4..9d163ad 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1071,7 +1071,7 @@ has_real_token(const char *s)
 static char *
 get_comp_string(void)
 {
-    enum lextok t0, tt0;
+    enum lextok t0, tt0, cmdtok;
     int i, j, k, cp, rd, sl, ocs, ins, oins, ia, parct, varq = 0;
     int ona = noaliases;
     /*
@@ -1146,6 +1146,7 @@ get_comp_string(void)
     linredir = inredir;
     zsfree(cmdstr);
     cmdstr = NULL;
+    cmdtok = NULLTOK;
     zsfree(varname);
     varname = NULL;
     insubscr = 0;
@@ -1264,6 +1265,7 @@ get_comp_string(void)
            ins = (tok == REPEAT ? 2 : (tok != STRING));
            zsfree(cmdstr);
            cmdstr = ztrdup(tokstr);
+           cmdtok = tok;
            /* If everything before is a redirection, don't reset the index */
            if (wordpos != redirpos)
                wordpos = redirpos = 0;
@@ -1271,10 +1273,11 @@ get_comp_string(void)
            /*
             * A following DOLOOP should cause us to reset to the start
             * of the command line.  For some reason we only recognise
-            * DOLOOP for this purpose (above) if ins is set.  Why?
-            * Don't ask pointless questions.
+            * DOLOOP for this purpose (above) if ins is set.  Why?  To
+            * handle completing multiple SEPER-ated command positions on
+            * the same command line, e.g., pipelines.
             */
-           ins = 1;
+           ins = (cmdtok != STRING);
        }
        if (!lexflags && tt0 == NULLTOK) {
            /* This is done when the lexer reached the word the cursor is on. */


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to