view: render URLs as "<url><zwp>[%d]" not "<url>[%d]"

When we render URLs like https://gnu.org/[1] right-clicking on them in
e.g. GNOME Terminal will also copy the "[1]" as well as the URL,
inserting zero-width-space[1] between the two avoids this.

I know about "g" (mu4e-view-go-to-url), but sometimes I want to open a
URL in a different browser, or copy it into a non-Emacs program. This
makes that easier. I think this improves the UI at a very trivial cost
to users that don't care about this use-case.

I could make this configurable, but unless someone vehemently objects
to this I don't see the point of not just making it the default.

In GNOME Terminal a ZWS is rendered simply as a space, and
copy/pasting works as expected, but in Emacs's GTK GUI there's no
space between the two.

This was initially a plain ASCII space character, but djcb preferred a
ZWP, and this works as well.

1. https://en.wikipedia.org/wiki/Zero-width_space
This commit is contained in:
Ævar Arnfjörð Bjarmason 2018-05-23 14:43:49 +02:00
parent 426b9a50c7
commit 6c8aec38be
1 changed files with 1 additions and 1 deletions

View File

@ -965,7 +965,7 @@ Also number them so they can be opened using `mu4e-view-go-to-url'."
help-echo
"[mouse-1] or [M-RET] to open the link"))
(overlay-put ov 'after-string
(propertize (format "[%d]" num)
(propertize (format "\u200B[%d]" num)
'face 'mu4e-url-number-face)))))))))