Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: The ~ parameter expansion flag: bug or misunderstanding



On Wed, 03 Sep 2014 20:18:24 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> What this doesn't say is that if STRING2 is the empty string, a space
> is inserted instead:

Apparently the same for STRING1.  Looking at the code, this appears to
be the following intentional but undocumented feature.

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index d01d804..b4aa9c7 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1155,6 +1155,10 @@ var(string1) and var(string2) are given, tt(string2) is inserted once
 directly to the left of each word, truncated if necessary, before
 var(string1) is used to produce any remaining padding.
 
+If either of var(string1) or tt(string2) is present but empty,
+i.e. there are two delimiters together at that point, the first
+character of tt($IFS) is used instead.
+
 If the tt(MULTIBYTE) option is in effect, the flag tt(m) may also
 be given, in which case widths will be used for the calculation of
 padding; otherwise individual multibyte characters are treated as occupying

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author