1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

17318: ${(z)...} added an extra space when the lexical analyser failed.

This commit is contained in:
Peter Stephenson 2002-06-14 17:52:05 +00:00
parent 2cf42676cc
commit 98307b767c
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2002-06-14 Peter Stephenson <pws@csr.com>
* 17318: Src/hist.c: ${(z)...} appended an extra space when the
lexical analyser failed.
2002-06-07 Peter Stephenson <pws@csr.com>
* 17304: Src/Zle/zle_main.c, Doc/Zsh/zle.yo: (suggested by Bart)

View file

@ -2291,7 +2291,16 @@ bufferwords(LinkList list, char *buf, int *index)
}
} while (tok != ENDINPUT && tok != LEXERR);
if (buf && tok == LEXERR && tokstr && *tokstr) {
int plen;
untokenize((p = dupstring(tokstr)));
plen = strlen(p);
/*
* Strip the space we added for lexing but which won't have
* been swallowed by the lexer because we aborted early.
* The test is paranoia.
*/
if (plen && p[plen-1] == ' ' && (plen == 1 || p[plen-2] != Meta))
p[plen - 1] = '\0';
addlinknode(list, p);
num++;
}