From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 6/9] view: indentation adjustments for collapsed headers
Date: Fri, 4 Sep 2015 08:58:56 +0000 [thread overview]
Message-ID: <1441357139-23879-7-git-send-email-e@80x24.org> (raw)
In-Reply-To: <1441357139-23879-1-git-send-email-e@80x24.org>
This makes the layout between the permalink threads and
index threads more consistent; hopefully.
---
lib/PublicInbox/View.pm | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index d025c99..4e800c6 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -687,7 +687,8 @@ sub _msg_date {
sub _inline_header {
my ($dst, $state, $upfx, $mime, $level) = @_;
- my $pfx = INDENT x $level;
+ my $pfx = INDENT x ($level - 1);
+ my $dot = $level == 0 ? '' : '` ';
my $cur = $state->{cur};
my $mid = mid_clean($mime->header('Message-ID'));
@@ -709,7 +710,7 @@ sub _inline_header {
if ($cur) {
if ($cur eq $mid) {
delete $state->{cur};
- $$dst .= "$pfx` <b><a\nid=\"r\"\nhref=\"#t\">".
+ $$dst .= "$pfx$dot<b><a\nid=\"r\"\nhref=\"#t\">".
"[this message]</a></b>$attr\n";
return;
@@ -733,9 +734,9 @@ sub _inline_header {
my $m = PublicInbox::Hval->new_msgid($mid);
$m = $upfx . '../' . $m->as_href . '/';
if (defined $s) {
- $$dst .= "$pfx` <a\nhref=\"$m\">$s</a>$attr\n";
+ $$dst .= "$pfx$dot<a\nhref=\"$m\">$s</a>$attr\n";
} else {
- $$dst .= "$pfx` <a\nhref=\"$m\">$f @ $d</a>\n";
+ $$dst .= "$pfx$dot<a\nhref=\"$m\">$f @ $d</a>\n";
}
}
@@ -749,7 +750,8 @@ sub inline_dump {
}
_inline_header($dst, $state, $upfx, $mime, $level);
} else {
- my $pfx = (INDENT x $level) . '` ';
+ my $dot = $level == 0 ? '' : '` ';
+ my $pfx = (INDENT x $level) . $dot;
$$dst .= $pfx . ghost_parent($upfx, $node->messageid) . "\n";
}
inline_dump($dst, $state, $upfx, $node->child, $level+1);
@@ -775,6 +777,7 @@ sub rsort_ts {
sub add_topic {
my ($state, $node, $level) = @_;
return unless $node;
+ my $child_adjust = 1;
if (my $x = $node->message) {
$x = $x->header_obj;
@@ -797,9 +800,12 @@ sub add_topic {
my $u = $x->header('X-PI-From');
my $ts = $x->header('X-PI-TS');
$state->{latest}->{$topic} = [ $mid, $u, $ts ];
- } # else { } # ghost ignored...
+ } else {
+ # ghost message, do not bump level
+ $child_adjust = 0;
+ }
- add_topic($state, $node->child, $level + 1);
+ add_topic($state, $node->child, $level + $child_adjust);
add_topic($state, $node->next, $level);
}
@@ -838,7 +844,8 @@ sub dump_topics {
$n = " ($n)\n";
}
if ($level == 0 || $attr ne $prev_attr) {
- $dst .= "$pfx - ". $attr . $n;
+ $pfx .= INDENT if $level > 0;
+ $dst .= "$pfx- ". $attr . $n;
$prev_attr = $attr;
}
}
--
EW
next prev parent reply other threads:[~2015-09-04 8:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-04 8:58 [PATCH 0/9] another round of updates Eric Wong
2015-09-04 8:58 ` [PATCH 1/9] view: eliminate redundant [threaded|flat] link Eric Wong
2015-09-04 8:58 ` [PATCH 2/9] view: one line for thread subjects Eric Wong
2015-09-04 8:58 ` [PATCH 3/9] view: adjust spacing and indentation of index threads Eric Wong
2015-09-04 8:58 ` [PATCH 4/9] view: add missing newline to inline dump Eric Wong
2015-09-04 8:58 ` [PATCH 5/9] view: reduce redundant attributions in permalink refs Eric Wong
2015-09-04 8:58 ` Eric Wong [this message]
2015-09-04 8:58 ` [PATCH 7/9] view: thread view expands focused message Eric Wong
2015-09-04 8:58 ` [PATCH 8/9] www: extra redirects for the '/'-challenged Eric Wong
2015-09-04 8:58 ` [PATCH 9/9] view: fix broken link to ghost fallback Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441357139-23879-7-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).