about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-04-17 21:49:52 +0000
committerEric Wong <e@80x24.org>2014-04-17 21:55:38 +0000
commitb926665849f6d317b97cf679becf1e315df701b0 (patch)
tree29ae100b845db0bc64158c7d4909e81f6063b74d /lib
parent20af945e6e9a89a33a531a71dd5a06fcd0bab9cb (diff)
downloadpublic-inbox-b926665849f6d317b97cf679becf1e315df701b0.tar.gz
Breaking up short quote messages at 1 line is too disconcerting,
try 5 lines as proper quotes shouldn't be too long.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 84c7393b..17aca94e 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -8,6 +8,7 @@ use CGI qw/escapeHTML/;
 use Encode qw/find_encoding/;
 use Encode::MIME::Header;
 use Email::MIME::ContentType qw/parse_content_type/;
+use constant MAX_INLINE_QUOTED => 5;
 
 my $enc_utf8 = find_encoding('utf8');
 my $enc_ascii = find_encoding('us-ascii');
@@ -88,10 +89,10 @@ sub add_text_body_short {
         my ($enc, $part, $part_nr, $full_pfx) = @_;
         my $n = 0;
         my $s = ascii_html($enc->decode($part->body));
-        $s =~ s!^((?:(?:&gt;[^\n]+)\n)+)!
+        $s =~ s!^((?:(?:&gt;[^\n]*)\n)+)!
                 my $cur = $1;
                 my @lines = split(/\n/, $cur);
-                if (@lines > 1) {
+                if (@lines > MAX_INLINE_QUOTED) {
                         # show a short snippet of quoted text
                         $cur = join(' ', @lines);
                         $cur =~ s/&gt; ?//g;
@@ -100,10 +101,10 @@ sub add_text_body_short {
                         $cur = '';
                         do {
                                 $cur .= shift(@sum) . ' ';
-                        } while (@sum && length($cur) < 68);
+                        } while (@sum && length($cur) < 64);
                         $cur=~ s/ \z/ .../;
                         "&gt; &lt;<a href=\"${full_pfx}#q${part_nr}_" . $n++ .
-                                "\">$cur<\/a>&gt;";
+                                "\">$cur<\/a>&gt;\n";
                 } else {
                         $cur;
                 }
@@ -115,10 +116,10 @@ sub add_text_body_full {
         my ($enc, $part, $part_nr) = @_;
         my $n = 0;
         my $s = ascii_html($enc->decode($part->body));
-        $s =~ s!^((?:(?:&gt;[^\n]+)\n)+)!
+        $s =~ s!^((?:(?:&gt;[^\n]*)\n)+)!
                 my $cur = $1;
                 my @lines = split(/\n/, $cur);
-                if (@lines > 1) {
+                if (@lines > MAX_INLINE_QUOTED) {
                         "<a name=q${part_nr}_" . $n++ . ">$cur</a>";
                 } else {
                         $cur;