unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH 0/3] view: visual and navigation tweaks
@ 2016-07-07  3:11 Eric Wong
  2016-07-07  3:11 ` [PATCH 1/3] view: reduce visual noise in conversation view Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2016-07-07  3:11 UTC (permalink / raw)
  To: meta

These little things should make the navigation experience a
little more tolerable in the per-message view.

Eric Wong (3):
      view: reduce visual noise in conversation view
      view: preserve attribution for current message
      view: per-message view links to real previous sibling

 lib/PublicInbox/View.pm | 57 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 22 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] view: reduce visual noise in conversation view
  2016-07-07  3:11 [PATCH 0/3] view: visual and navigation tweaks Eric Wong
@ 2016-07-07  3:11 ` Eric Wong
  2016-07-07  3:11 ` [PATCH 2/3] view: preserve attribution for current message Eric Wong
  2016-07-07  3:11 ` [PATCH 3/3] view: per-message view links to real previous sibling Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2016-07-07  3:11 UTC (permalink / raw)
  To: meta

No need for ' / ' delimiters on lines dedicated for hyperlinks.
---
 lib/PublicInbox/View.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 0903550..7be72cf 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -156,10 +156,10 @@ sub index_entry {
 	# add the footer
 	$rv .= "\n<a\nhref=#$id_m\nid=e$id>^</a> ".
 		"<a\nhref=\"$mhref\">permalink</a>" .
-		" / <a\nhref=\"${mhref}raw\">raw</a>" .
-		" / <a\nhref=\"${mhref}#R\">reply</a>";
+		" <a\nhref=\"${mhref}raw\">raw</a>" .
+		" <a\nhref=\"${mhref}#R\">reply</a>";
 	if (my $pct = $ctx->{pct}) { # used by SearchView.pm
-		$rv .= " [relevance $pct->{$mid_raw}%]";
+		$rv .= "\t[relevance $pct->{$mid_raw}%]";
 	} elsif ($mapping) {
 		my $threaded = 'threaded';
 		my $flat = 'flat';
@@ -169,9 +169,9 @@ sub index_entry {
 		} else {
 			$threaded = "<b>$threaded</b>";
 		}
-		$rv .= " / [<a\nhref=\"${mhref}T/#u\">$flat</a>";
+		$rv .= "\t[<a\nhref=\"${mhref}T/#u\">$flat</a>";
 		$rv .= "|<a\nhref=\"${mhref}t/#u\">$threaded</a>]";
-		$rv .= " / <a\nhref=#r$id>$ctx->{s_nr}</a>";
+		$rv .= " <a\nhref=#r$id>$ctx->{s_nr}</a>";
 	}
 
 	$rv .= $more ? "\n\n" : "\n";
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] view: preserve attribution for current message
  2016-07-07  3:11 [PATCH 0/3] view: visual and navigation tweaks Eric Wong
  2016-07-07  3:11 ` [PATCH 1/3] view: reduce visual noise in conversation view Eric Wong
@ 2016-07-07  3:11 ` Eric Wong
  2016-07-07  3:11 ` [PATCH 3/3] view: per-message view links to real previous sibling Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2016-07-07  3:11 UTC (permalink / raw)
  To: meta

It should be harmless if the "[this message]" text goes past
the boundary as we bold the entire line to make it stand out.
---
 lib/PublicInbox/View.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 7be72cf..f47ecba 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -735,16 +735,13 @@ sub _skel_header {
 
 	if ($attr ne $ctx->{prev_attr} || $ctx->{prev_level} > $level) {
 		$ctx->{prev_attr} = $attr;
-	} else {
-		$attr = '';
 	}
 	$ctx->{prev_level} = $level;
 
 	if ($cur) {
 		if ($cur eq $mid) {
 			delete $ctx->{cur};
-			$$dst .= $d;
-			$$dst .= "<b><a\nid=r\nhref=\"#t\">".
+			$$dst .= "<b>$d<a\nid=r\nhref=\"#t\">".
 				 "$attr [this message]</a></b>\n";
 			return;
 		}
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] view: per-message view links to real previous sibling
  2016-07-07  3:11 [PATCH 0/3] view: visual and navigation tweaks Eric Wong
  2016-07-07  3:11 ` [PATCH 1/3] view: reduce visual noise in conversation view Eric Wong
  2016-07-07  3:11 ` [PATCH 2/3] view: preserve attribution for current message Eric Wong
@ 2016-07-07  3:11 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2016-07-07  3:11 UTC (permalink / raw)
  To: meta

This is closer to the behavior of thread-aware MUAs.
---
 lib/PublicInbox/View.pm | 42 +++++++++++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index f47ecba..054b358 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -636,21 +636,35 @@ sub html_footer {
 	if ($idx && $srch) {
 		$idx .= "\n";
 		thread_skel(\$idx, $ctx, $hdr, $tpfx);
-		my $p = $ctx->{parent_msg};
-		my $next = $ctx->{next_msg};
-		if ($p) {
-			$p = PublicInbox::Hval->new_msgid($p);
-			$p = $p->as_href;
-			$irt = "<a\nhref=\"$upfx$p/\"\nrel=prev>parent</a> ";
-		} else {
-			$irt = ' ' x length('parent ');
+		my ($next, $prev);
+		my $parent = '       ';
+		$next = $prev = '    ';
+
+		if (my $n = $ctx->{next_msg}) {
+			$n = PublicInbox::Hval->new_msgid($n)->as_href;
+			$next = "<a\nhref=\"$upfx$n/\"\nrel=next>next</a>";
 		}
-		if ($next) {
-			my $n = PublicInbox::Hval->new_msgid($next)->as_href;
-			$irt .= "<a\nhref=\"$upfx$n/\"\nrel=next>next</a> ";
-		} else {
-			$irt .= ' ' x length('next ');
+		my $u;
+		my $par = $ctx->{parent_msg};
+		if ($par) {
+			$u = PublicInbox::Hval->new_msgid($par)->as_href;
+			$u = "$upfx$u/";
 		}
+		if (my $p = $ctx->{prev_msg}) {
+			$prev = PublicInbox::Hval->new_msgid($p)->as_href;
+			if ($p && $par && $p eq $par) {
+				$prev = "<a\nhref=\"$upfx$prev/\"\n" .
+					'rel=prev>prev parent</a>';
+				$parent = '';
+			} else {
+				$prev = "<a\nhref=\"$upfx$prev/\"\n" .
+					'rel=prev>prev</a>';
+				$parent = " <a\nhref=\"$u\">parent</a>" if $u;
+			}
+		} elsif ($u) { # unlikely
+			$parent = " <a\nhref=\"$u\"\nrel=prev>parent</a>";
+		}
+		$irt = "$next $prev$parent ";
 	} else {
 		$irt = '';
 	}
@@ -744,6 +758,8 @@ sub _skel_header {
 			$$dst .= "<b>$d<a\nid=r\nhref=\"#t\">".
 				 "$attr [this message]</a></b>\n";
 			return;
+		} else {
+			$ctx->{prev_msg} = $mid;
 		}
 	} else {
 		$ctx->{next_msg} ||= $mid;
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-07  3:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-07  3:11 [PATCH 0/3] view: visual and navigation tweaks Eric Wong
2016-07-07  3:11 ` [PATCH 1/3] view: reduce visual noise in conversation view Eric Wong
2016-07-07  3:11 ` [PATCH 2/3] view: preserve attribution for current message Eric Wong
2016-07-07  3:11 ` [PATCH 3/3] view: per-message view links to real previous sibling Eric Wong

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