Open frasertweedale opened 3 years ago
Also, we can maybe look at finding URLs ourselves and using hyperlink escapes to add links: https://hackage.haskell.org/package/vty-5.33/docs/Graphics-Vty-Attributes.html#v:withURL. (Not mutually exclusive with other suggestions).
I think it should be as simple as rendering them as a hyperlink.
I think it should be as simple as rendering them as a hyperlink.
After some more investigation, no, this won't work. Not all terminals support it. Indeed neither xterm nor xfce4-terminal support it. tmux also swallows the hyperlink escapes - even if the "outer" terminal supports hyperlink.
I think as a baseline, copy+paste must work, even if it means that "smart" terminal rendering of http links breaks for wrapped URIs.
Yeah fair enough. I guess due to the problem that it only sometimes works, tools like urlscan
or urlview
exist ...
Describe the bug When viewing a URL in the pager, if it is too wide it gets clipped, not wrapped. I suppose this is a general issue with long "words", but it is unlikely to arise in ordinary text (even in German!) But long URLs are common. So we need to handle this better.
To Reproduce Read a mail that contains a URL wider than the terminal.
Expected behavior URL should be wrapped, with the following expectations:
The URL text, when copied, does not include any extra spaces or other characters.
The whole display does not get corrupted in any way in the presence of long, wrapped URLs/words.
Ideally, when using a terminal that generates hyperlinks for URLs rendered therein, the wrapping should not break the link. That is, the hyperlink target should be the whole URL.
Additional context
An alternative approach, and one I have occasionally wished for in Mutt, is to automatically rewrite long links to a shortened URL, pointing to a local (perhaps ephemeral) HTTP server that can direct the client. For example, rewrite
https://REALLY_LONG
tohttp://localhost/SHORT
that serves up a 301 pointing to the former.For now, it is enough to ensure that copy/paste works.