user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 6/9] view: indentation adjustments for collapsed headers
  @ 2015-09-04  8:58  7% ` Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2015-09-04  8:58 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-04  8:58     [PATCH 0/9] another round of updates Eric Wong
2015-09-04  8:58  7% ` [PATCH 6/9] view: indentation adjustments for collapsed headers Eric Wong

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).