From: Eric Wong <e@80x24.org>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: meta@public-inbox.org
Subject: [PATCH] viewdiff: do not anchor spaces after filenames in diffstat
Date: Sat, 4 Jan 2020 09:16:21 +0000 [thread overview]
Message-ID: <20200104091621.GA25644@dcvr> (raw)
In-Reply-To: <20190705085559.GG20404@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> wrote:
> On Fri, Jul 05, 2019 at 04:06:18AM +0000, Eric Wong wrote:
> > Eric Wong <e@80x24.org> wrote:
> > > SZEDER Gábor <szeder.dev@gmail.com> 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 .= " <a\nid=i$attr\nhref=#$attr>" .
- ascii_html($orig) . '</a>'.
+ ascii_html($orig) . '</a>' . $spaces .
to_html($linkify, $rest);
return 1;
}
prev parent reply other threads:[~2020-01-04 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 23:11 broken link in diffstat for new files SZEDER Gábor
2019-07-05 4:03 ` [PATCH] viewdiff: do not anchor using diffstat comments Eric Wong
2019-07-05 4:06 ` Eric Wong
2019-07-05 8:55 ` SZEDER Gábor
2020-01-04 9:16 ` Eric Wong [this message]
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=20200104091621.GA25644@dcvr \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
--cc=szeder.dev@gmail.com \
/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).