From e5f356a95e3c867e1f554e1b77dd6b463566107a Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Fri, 25 May 2018 20:36:37 +0900 Subject: 42809: slightly improve 'compset -q' --- Src/Zle/compcore.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Src') 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; -- cgit 1.4.1