]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
view: cleaner killing of leading/trailing whitespace
[public-inbox.git] / lib / PublicInbox / View.pm
index 660a112ff3c67633bad4cedf366321e89f951e54..e1632b5bec319fa6667925e79f9d31d50d30df0e 100644 (file)
@@ -142,14 +142,17 @@ sub index_walk {
        # Drop signatures
        $s =~ s/^-- \n.*\z//ms and $$more = 'more...';
 
-       # kill any leading or trailing whitespace
-       $s =~ s/\A\s+//s;
+       # kill any leading or trailing whitespace lines
+       $s =~ s/^[ \t]$//sgm;
        $s =~ s/\s+\z//s;
 
        if (length $s) {
                # add prefix:
                $s =~ s/^/$pfx/sgm;
 
+               # kill per-line trailing whitespace
+               $s =~ s/[ \t]+$//sgm;
+
                $rv .= $s . "\n";
        }
        $rv;