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

Feature Request: Add support for hyperlinks with -R #54

Closed
tomprince opened this issue Apr 9, 2020 · 7 comments
Closed

Feature Request: Add support for hyperlinks with -R #54

tomprince opened this issue Apr 9, 2020 · 7 comments

Comments

@tomprince
Copy link

There is a standard for displaying hyperlinks in terminals here. It would be nice if less passed through those escapes when -R is passed, like it does colors.

(Originally reported as 308 on the bug list)

There is a patch here (from here).

@poettering
Copy link

Note that bigger projects including gcc and systemd nowadays generate hyperlinks like that in their output. It would be excellent if less would handle this correctly!

(I am systemd maintainer)

@dandavison
Copy link

In case it helps the process of getting this feature into master, I have applied the patch (with minor modifications to fix the conflicts) on master, confirmed that hyperlinks are working, and opened a PR: #75.

(My motivation for this is that I'm the author of an application that relies on less for paging and would like to use hyperlinks: dandavison/delta#261.)

@torarnv
Copy link

torarnv commented Oct 3, 2020

If adding to what -R does is seen as too risky for backwards compatibility, perhaps a new environment variable similar to LESSANSIENDCHARSand LESSANSIMIDCHARS could be added that controls which control codes to pass through, defaulting to the existing ANSI color escape sequences?

@gwsw
Copy link
Owner

gwsw commented Nov 29, 2020

This is implemented in 3bb781e. My tests with self-constructed files seem to work fine, but could someone who regularly uses files containing such hyperlinks confirm that the behavior is as expected?

@dandavison
Copy link

dandavison commented Nov 29, 2020

Thanks very much for working on this @gwsw. I have built 3bb781e locally and can confirm that it is working as expected for me.

(The way I tested was a bit idiosyncratic, but for the record I used delta with the setting hyperlinks = true and issued git show. With the version of less that I had installed already, the hyperlink was displayed correctly only if I used the -r flag, but not with -R (as expected). With the version of less built from 3bb781e the hyperlink was displayed correctly when I used less -R and also less -r. So that all matched my expectations. This was on MacOS under iTerm2.).

@tomprince
Copy link
Author

I can confirm that 607c9b6 works as expected with hyperlinks. Thanks!

@torarnv
Copy link

torarnv commented Dec 28, 2020

Can confirm that this works as expected in v570. Thanks!!

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

No branches or pull requests

5 participants