about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-24 11:52:42 +0000
committerEric Wong <e@80x24.org>2016-12-24 19:41:00 +0000
commit2e05c4503e44d4d9bf126589b7c6ba71db7ce94e (patch)
treef6cffa310d9510382acf75367b686d8d71da8e32 /lib
parent8b8be7ffc64e9e36308df2a592b6afd55e593442 (diff)
downloadpublic-inbox-2e05c4503e44d4d9bf126589b7c6ba71db7ce94e.tar.gz
This allows a 3-4% speedup in $MESSAGE_ID/T/ page generation
speed for a 368+ message thread.  It also more faithfully
preserves the message as intended; even if the it makes the
sender look like a space-wasting slob :P
Diffstat (limited to 'lib')
-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 {