aerc/filters/plaintext
Daniel Xu ea4fe71360 Strip carriage returns (^M) when filtering emails
Presumably some email servers will transform newlines into carriage
return new lines to better support windows users. I can't prove this but
that's the best explanation I have for my hosted email provider
(fastmail).

Without this patch, I was seeing annoying `^M`s at the end of every
filtered line.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
2019-08-20 16:05:20 +09:00

17 lines
243 B
Awk
Executable file

# vim: set ft=awk :
BEGIN {
dim = "\x1B[2m"
cyan = "\x1B[36m"
reset = "\x1B[0m"
}
{
# Strip carriage returns from line
gsub(/\r/, "", $0)
if ($0 ~ /^On .*, .* wrote:/ || $0 ~ /^>+/) {
print dim cyan $0 reset
} else {
print $0
}
}