about summary refs log tree commit diff
path: root/Src/Zle/zle_tricky.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-06-26 17:56:44 +0100
committerPeter Stephenson <pws@zsh.org>2015-06-26 17:56:44 +0100
commit77a0278bcc5b9ae1dc70e1705b4fce0bc910558f (patch)
tree237d26cdd0fa4b6c77d0108d4e0481093b75a688 /Src/Zle/zle_tricky.c
parent42b9037ae5c1c62866d4dafee444f578c0335ff7 (diff)
downloadzsh-77a0278bcc5b9ae1dc70e1705b4fce0bc910558f.tar.gz
zsh-77a0278bcc5b9ae1dc70e1705b4fce0bc910558f.tar.xz
zsh-77a0278bcc5b9ae1dc70e1705b4fce0bc910558f.zip
35615: fix completion after tyepset
Diffstat (limited to 'Src/Zle/zle_tricky.c')
-rw-r--r--Src/Zle/zle_tricky.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index f18ad170e..7217abc7a 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1190,6 +1190,12 @@ get_comp_string(void)
 	/* Get the next token. */
 	if (linarr)
 	    incmdpos = 0;
+	/*
+	 * Arrange to parse assignments after typeset etc...
+	 * but not if we're already in an array.
+	 */
+	if (cmdtok == TYPESET)
+	    intypeset = !linarr;
 	ctxtlex();
 
 	if (tok == LEXERR) {
@@ -1272,10 +1278,11 @@ get_comp_string(void)
 	    tt0 = NULLTOK;
 	}
 	if (lincmd && (tok == STRING || tok == FOR || tok == FOREACH ||
-		       tok == SELECT || tok == REPEAT || tok == CASE)) {
+		       tok == SELECT || tok == REPEAT || tok == CASE ||
+		       tok == TYPESET)) {
 	    /* The lexer says, this token is in command position, so *
 	     * store the token string (to find the right compctl).   */
-	    ins = (tok == REPEAT ? 2 : (tok != STRING));
+	    ins = (tok == REPEAT ? 2 : (tok != STRING && tok != TYPESET));
 	    zsfree(cmdstr);
 	    cmdstr = ztrdup(tokstr);
 	    cmdtok = tok;
@@ -1290,7 +1297,7 @@ get_comp_string(void)
 	     * handle completing multiple SEPER-ated command positions on
 	     * the same command line, e.g., pipelines.
 	     */
-	    ins = (cmdtok != STRING);
+	    ins = (cmdtok != STRING && cmdtok != TYPESET);
 	}
 	if (!lexflags && tt0 == NULLTOK) {
 	    /* This is done when the lexer reached the word the cursor is on. */
@@ -1436,7 +1443,7 @@ get_comp_string(void)
 	we = wb = zlemetacs;
 	clwpos = clwnum;
 	t0 = STRING;
-    } else if (t0 == STRING) {
+    } else if (t0 == STRING || t0 == TYPESET) {
 	/* We found a simple string. */
 	s = ztrdup(clwords[clwpos]);
     } else if (t0 == ENVSTRING) {
@@ -1492,7 +1499,7 @@ get_comp_string(void)
 	zlemetaline = tmp;
 	zlemetall = strlen(zlemetaline);
     }
-    if (t0 != STRING && inwhat != IN_MATH) {
+    if (t0 != STRING && t0 != TYPESET && inwhat != IN_MATH) {
 	if (tmp) {
 	    tmp = NULL;
 	    linptr = zlemetaline;