Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long URLs not wrapped #434

Open
frasertweedale opened this issue Jun 23, 2021 · 5 comments
Open

Long URLs not wrapped #434

frasertweedale opened this issue Jun 23, 2021 · 5 comments

Comments

@frasertweedale
Copy link
Member

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 to http://localhost/SHORT that serves up a 301 pointing to the former.

For now, it is enough to ensure that copy/paste works.

@frasertweedale
Copy link
Member Author

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

@romanofski
Copy link
Member

I think it should be as simple as rendering them as a hyperlink.

@frasertweedale
Copy link
Member Author

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.

@frasertweedale
Copy link
Member Author

I think as a baseline, copy+paste must work, even if it means that "smart" terminal rendering of http links breaks for wrapped URIs.

@romanofski
Copy link
Member

Yeah fair enough. I guess due to the problem that it only sometimes works, tools like urlscan or urlview exist ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants