Commit 3f323ca9 3f323ca9cee9fdb3a04f2f7269998fdc1f941f5e by Sergey Poznyakoff

wordsplit: fix whitespace trimming.

* libmailutils/string/wordsplit.c (mu_wordsplit_trimws): Do not
touch quoted nodes.
* libmailutils/tests/wordsplit.at: Test the above change.
1 parent 36e8269d
......@@ -947,6 +947,9 @@ mu_wordsplit_trimws (struct mu_wordsplit *wsp)
{
size_t n;
if (p->flags & _WSNF_QUOTE)
continue;
/* Skip leading whitespace: */
for (n = p->v.segm.beg; n < p->v.segm.end && ISWS (wsp->ws_input[n]);
n++)
......
......@@ -324,5 +324,15 @@ TESTWSP([delimiter following empty quotes],[],[delim : ws return_delims],
2: r
])
TESTWSP([suppress ws trimming within quotes],[],
[default delim , ws return_delims],
[nocomponent,nonewline, formatfield="In message %{text}, "],
[NF: 5
0: nocomponent
1: ,
2: nonewline
3: ,
4: "formatfield=In message %{text}, "
])
m4_popdef([TESTWSP])
......