summaryrefslogtreecommitdiff
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
parent42b9037ae5c1c62866d4dafee444f578c0335ff7 (diff)
downloadzsh-77a0278bcc5b9ae1dc70e1705b4fce0bc910558f.tar.gz
zsh-77a0278bcc5b9ae1dc70e1705b4fce0bc910558f.zip
35615: fix completion after tyepset
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_tricky.c17
-rw-r--r--Src/lex.c1
3 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 6778d3258..ed1b75088 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2015-06-26 Peter Stephenson <p.stephenson@samsung.com>
+ * 35615: Src/lex.c, Src/Zle/zle_tricky.c:
+ fix completion after typeset.
+
* 35613: Src/builtin.c, Test/B02typeset: handle
array slices in typeset.
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;
diff --git a/Src/lex.c b/Src/lex.c
index d56f670d2..baeed1365 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -339,6 +339,7 @@ ctxtlex(void)
incmdpos = 1;
break;
case STRING:
+ case TYPESET:
/* case ENVSTRING: */
case ENVARRAY:
case OUTPAR: