From 17e79c01575b26e28e5f978d99cff250a6d9e63b Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Wed, 3 May 2000 13:05:39 +0000 Subject: fix for the (z) flag: report partial word (like `"foo', without a closing quote); mention in manual that (z) is handled lately (11117) --- ChangeLog | 4 ++++ Doc/Zsh/expn.yo | 7 ++++++- Src/hist.c | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6030303a6..9a7757b7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2000-05-03 Sven Wischnowsky + * 11117: Doc/Zsh/expn.yo, Src/hist.c: fix for the (z) flag: report + partial word (like `"foo', without a closing quote); mention in + manual that (z) is handled lately + * Andrej: 11067: Completion/Builtins/_zcompile: handle -t option * 11113: Doc/Zsh/expn.yo, Src/hist.c, Src/subst.c, diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index e9e3b95c9..c0e525067 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -679,6 +679,11 @@ for `tt(ps:\n:)'. item(tt(z))( Split the result of the expansion into words using shell parsing to find the words, i.e. taking into account any quoting in the value. + +Note that this is done very lately, as for the `tt((s))' flag. So to +access single words in the result, one has to use nested expansions as +in `tt(${${(z)foo}[2]}'. Likewise, to remove the quotes in the +resulting words one would do: `tt(${(Q)${(z)foo}})'. ) item(tt(t))( Use a string describing the type of the parameter where the value @@ -839,7 +844,7 @@ Note that the `tt((F))' flag implicitly supplies a string for joining in this manner. ) item(tt(8.) em(Forced Splitting))( -If one of the `tt((s))' or `tt((f))' flags are present, or the `tt(=)' +If one of the `tt((s))', `tt((f))' or `tt((z))' flags are present, or the `tt(=)' specifier was present (e.g. tt(${=)var(var)tt(})), the word is split on occurrences of the specified string, or (for tt(=) with neither of the two flags present) any of the characters in tt($IFS). diff --git a/Src/hist.c b/Src/hist.c index 3dde19845..e869e3a2e 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -2102,6 +2102,11 @@ bufferwords(LinkList list, char *buf, int *index) cur = num - 1; } } while (tok != ENDINPUT && tok != LEXERR); + if (buf && tok == LEXERR && tokstr && *tokstr) { + untokenize((p = dupstring(tokstr))); + addlinknode(list, p); + num++; + } if (cur < 0 && num) cur = num - 1; noaliases = 0; -- cgit 1.4.1