summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-06-14 17:52:05 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-06-14 17:52:05 +0000
commit98307b767c106690123c83f608ab51dc461c66ae (patch)
tree47eea978db5d6c0b5979d99b51af5cb6f22c3209
parent2cf42676cc483c553a810ba99d1337340c46d6b5 (diff)
downloadzsh-98307b767c106690123c83f608ab51dc461c66ae.tar.gz
zsh-98307b767c106690123c83f608ab51dc461c66ae.zip
17318: ${(z)...} added an extra space when the lexical analyser failed.
-rw-r--r--ChangeLog5
-rw-r--r--Src/hist.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fdc27b467..1a2eea3a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
diff --git a/Src/hist.c b/Src/hist.c
index 0b9bf2c17..f1f240d3d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -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++;
}