From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 65A2A1F463; Sat, 4 Jan 2020 09:16:21 +0000 (UTC) Date: Sat, 4 Jan 2020 09:16:21 +0000 From: Eric Wong To: SZEDER =?utf-8?B?R8OhYm9y?= Cc: meta@public-inbox.org Subject: [PATCH] viewdiff: do not anchor spaces after filenames in diffstat Message-ID: <20200104091621.GA25644@dcvr> References: <20190704231123.GF20404@szeder.dev> <20190705040311.GA2896@dcvr> <20190705040618.gnbg6jvzqqcn3i5e@dcvr> <20190705085559.GG20404@szeder.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190705085559.GG20404@szeder.dev> List-Id: SZEDER Gábor wrote: > On Fri, Jul 05, 2019 at 04:06:18AM +0000, Eric Wong wrote: > > Eric Wong wrote: > > > SZEDER Gábor wrote: > > > > https://public-inbox.org/git/20190624130226.17293-2-pclouds@gmail.com/ > > > > Btw, I'm not sure if the "(new +x)" and all the surrounding > > spaces should be clickable. I have poor coordination, so when I > > (rarely) use a mouse I prefer bigger targets to click; but maybe > > it can get confusing... > > FWIW, I didn't find it odd or surprising that the "(new +x)" is part > of the link, and its color clearly indicates that it is part of the > link. > > I haven't yet noticed that all the spaces following the filename are > clickable as well, because they don't look like part of the link > (well, being spaces, they don't have any color...), and haven't > noticed the cursor changing shape when hovering over them. > > I'm not so sure about this, and think that it can be > confusing/undesired in some circumstances. A user can click on any > "inactive" part of the browser window (i.e. what isn't a link, a > button, or any active GUI widget) to focus and raise the window > without any other effects, so they might just happen to click on > those unsuspicious spaces because they don't look like a link, and > then be surprised when the page jumps to corresponding diff. OK, I didn't realize how bad the problem is, since I mainly use w3m for web development and that doesn't underline links by default. Will push this out soon: ------8<------ Subject: [PATCH] viewdiff: do not anchor spaces after filenames in diffstat Viewing a CSS-less page in a browser which underlines links can show a long line of underscores after diffstats. Not all browsers underline links by default, though. --- lib/PublicInbox/ViewDiff.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 4669e874..4d72eb48 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -104,8 +104,9 @@ sub anchor0 ($$$$$) { if (my $attr = to_attr($ctx->{-apfx}.$fn)) { $ctx->{-anchors}->{$attr} = 1; + my $spaces = ($orig =~ s/( +)\z//) ? $1 : ''; $$dst .= " " . - ascii_html($orig) . ''. + ascii_html($orig) . '' . $spaces . to_html($linkify, $rest); return 1; }