lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Make URLs in confirmation panels clickable, and underline them

Open stefanhaller opened this issue 1 year ago • 4 comments

  • PR Description

This is especially helpful for the breaking changes popup, which has a link to the release notes, but it could also be useful for other panels that display some warning or error with a link to more information.

  • Please check if the PR fulfills these requirements
  • [x] Cheatsheets are up-to-date (run go generate ./...)
  • [x] Code has been formatted (see here)
  • [x] Tests have been added/updated (see here for the integration test guide)
  • [ ] Text is internationalised (see here)
  • [ ] Docs (specifically docs/Config.md) have been updated if necessary
  • [x] You've read through your own file changes for silly mistakes etc

stefanhaller avatar Mar 27 '24 18:03 stefanhaller

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: -0.04% (target: -2.00%) :white_check_mark: 54.90%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1cedfa463b83b1d50fdba5abec5d16d21ffd36a8) 50365 42372 84.13%
Head commit (5d509efe19b4f17b971470dadca6e1d18ea3c369) 50405 (+40) 42388 (+16) 84.09% (-0.04%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3446) 51 28 54.90%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

codacy-production[bot] avatar Mar 27 '24 18:03 codacy-production[bot]

Thoughts on using tcell's terminal hyperlinks ability? https://github.com/gdamore/tcell/issues/300

jesseduffield avatar Mar 28 '24 11:03 jesseduffield

I had no idea this existed. I'll play with this to see if it's useful for our case.

stefanhaller avatar Mar 28 '24 12:03 stefanhaller

So I'm not very thrilled by tcell's hyperlinks. I couldn't get it to work in Terminal.app, only in iTerm2 (but I may well have done something wrong). In general it's a bit unclear to me how widely supported the feature is yet.

Also, you have to hold down Command while clicking them (ctrl on Windows), which I find inconvenient, and hard to discover. I would prefer them to behave more like links on a web page; just click them.

Finally, it would take some effort to make this available in gocui, it's actually not quite clear to me how to design the APIs. There's plenty of code that just passes around fg and bg Attributes to functions (and those are enums); but we need to pass attached data for this one. It would take a while to add this to the current design of how attributes work in gocui.

To sum it up, I'd prefer to stick with the more pedestrian approach I'm taking here.

stefanhaller avatar Mar 28 '24 16:03 stefanhaller