about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index cf40b555..97a8bcbc 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -490,15 +490,13 @@ sub add_text_body {
                 }
         }
 
-        my $end = "\n";
-        if (@quot) {
-                $end = '';
+        if (@quot) { # ugh, top posted
                 flush_quote(\$s, $l, \@quot);
+        } elsif ($s =~ /\n\z/s) { # common, last line ends with a newline
+                $s;
+        } else { # some editors don't do newlines...
+                $s .= "\n";
         }
-        $s =~ s/[ \t]+$//sgm; # kill per-line trailing whitespace
-        $s =~ s/\A\n+//s; # kill leading blank lines
-        $s =~ s/\s+\z//s; # kill all trailing spaces
-        $s .= $end;
 }
 
 sub _msg_html_prepare {