about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2013-12-25 16:24:27 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2013-12-25 16:24:27 -0800
commit1136b9b296f4adff75ebd11ad1a087fd83d92acf (patch)
tree23db4ede2a32ec2207cf66cebc9496aa9c45a13c /Src
parent15f4843c676cf73a854b35ec7fddb2cfe6be6fbe (diff)
downloadzsh-1136b9b296f4adff75ebd11ad1a087fd83d92acf.tar.gz
zsh-1136b9b296f4adff75ebd11ad1a087fd83d92acf.tar.xz
zsh-1136b9b296f4adff75ebd11ad1a087fd83d92acf.zip
32182: re-enable command completion after a separator
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_tricky.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 25f09c459..9d163ad9e 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. */