summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2018-05-25 20:36:37 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2018-05-25 21:11:20 +0900
commite5f356a95e3c867e1f554e1b77dd6b463566107a (patch)
tree07958f0b63bda4e8714a1de50374530e6127b973 /Src
parent5e2d3d1e15e94e3d727e7393cbce2667a93f2fd4 (diff)
downloadzsh-e5f356a95e3c867e1f554e1b77dd6b463566107a.tar.gz
zsh-e5f356a95e3c867e1f554e1b77dd6b463566107a.tar.xz
zsh-e5f356a95e3c867e1f554e1b77dd6b463566107a.zip
42809: slightly improve 'compset -q'
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compcore.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index c3b971e0d..f733e0ee5 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1638,7 +1638,7 @@ set_comp_sep(void)
 		    p[-1] = '\0';
 	    }
 	}
-	if (tok == ENDINPUT || tok == LEXERR)
+	if (tok == ENDINPUT)
 	    break;
 	if (tokstr && *tokstr) {
             for (p = tokstr; dq && *p; p++) {
@@ -1667,7 +1667,7 @@ set_comp_sep(void)
 	if (!got && !lexflags) {
 	    DPUTS(!p, "no current word in substr");
 	    got = 1;
-	    cur = i;
+	    cur = countlinknodes(foo) - 1;  /* cur is 0 offset */
 	    swb = wb - 1 - dq - sq - dolq;
 	    swe = we - 1 - dq - sq - dolq;
             sqq = lsq;
@@ -1902,7 +1902,10 @@ set_comp_sep(void)
 	    untokenize(p);
 	}
 	/* The current position shouldn't exceed the new word count */
-	compcurrent = cur + 1 > i ? i : cur + 1;
+	if ((compcurrent = cur + 1) > i) {
+	    DPUTS2(1, "compcurrent=%d > number_of_words=%d", compcurrent, i);
+	    compcurrent = i;
+	}
 	compwords[i] = NULL;
     }
     instring = ois;