aboutsummaryrefslogtreecommitdiffstats
path: root/filters/wrap.c
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-04-10 11:49:32 +0200
committerRobin Jarry <robin@jarry.cc>2023-04-10 15:00:13 +0200
commitdd575e2867b012b78d89503583ac9a368adcdd18 (patch)
tree140ba7a21ed878a612163702be47994e22eeb258 /filters/wrap.c
parent423a78866ef2205e19b859ca3ec0b6405161e636 (diff)
downloadaerc-dd575e2867b012b78d89503583ac9a368adcdd18.tar.gz
wrap: do not strip signature delimiter trailing space
Some tools expect this trailing space to be present to detect email signatures start. Reported-by: Jd <john1doe@ya.ru> Fixes: https://todo.sr.ht/~rjarry/aerc/131 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jd <john1doe@ya.ru>
Diffstat (limited to 'filters/wrap.c')
-rw-r--r--filters/wrap.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/filters/wrap.c b/filters/wrap.c
index cfe86581..5f5279c8 100644
--- a/filters/wrap.c
+++ b/filters/wrap.c
@@ -246,11 +246,13 @@ static struct paragraph *parse_line(const wchar_t *buf)
letters++;
}
}
- /* strip trailing whitespace */
+ /* strip trailing whitespace unless it is a signature delimiter */
flowed = false;
- while (e > q && iswspace(buf[e - 1])) {
- e--;
- flowed = true;
+ if (wcscmp(&buf[q], L"-- ") != 0) {
+ while (e > q && iswspace(buf[e - 1])) {
+ e--;
+ flowed = true;
+ }
}
text_len = e - q;
@@ -287,7 +289,7 @@ static bool is_continuation(
if (is_empty(next->text))
/* empty or whitespace only line */
return false;
- if (wcscmp(p->text, L"--") == 0)
+ if (wcscmp(p->text, L"--") == 0 || wcscmp(p->text, L"-- ") == 0)
/* never join anything with signature start */
return false;
if (p->flowed)