lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

links have awful user experience

Open gcb opened this issue 1 month ago • 4 comments

Describe the bug

right on the start, opening on xterm, with no feature to open links in browser (or even detect links), when one try to select the youtube tutorial link, hundreds of browsers are forked in the background.

To Reproduce

Steps to reproduce the behavior:

  1. start xterm
  2. open lazygit for the first time
  3. try to select (to copy) the links on the initial "popup"

Expected behavior

I can select the text. but instead my browser on the background spans a few dozen tabs to the link.

Version info:

commit=v0.56.0, build date=2025-11-01T16:13:09Z, build source=binaryRelease, version=0.56.0, os=linux, arch=amd64, git version=2.52.0

gcb avatar Nov 20 '25 16:11 gcb

I can only guess here, but this sounds like a problem with xterm to me. I don't have a linux box to test this, sorry.

Could you try a different terminal? I like ghostty myself.

Also sounds related to #3928.

stefanhaller avatar Nov 23 '25 17:11 stefanhaller

it's a problem as there's a standard to show just a URL (and terminals might or might not have magic to send the url to the window manager/desktopenvironment/etc, which then handle the link), not to fork browsers processes. This break tons of things. Sandboxing, etc.

gcb avatar Nov 26 '25 14:11 gcb

I can reproduce on wsl2 inside of WezTerm, as well as inside iTerm2 on MacOS, and the command log pretty clearly shows that it is lazygit choosing to launch the links.

Image

I have identified the code responsible for launching these links: https://github.com/jesseduffield/lazygit/blob/17d03ec8cb89d4c65fd129228164562a220abefb/vendor/github.com/jesseduffield/gocui/gui.go#L1394-L1400 and can reliably make the following behaviors happen, that don't seem like they should (even if we assume for the sake of argument that lazygit should have a feature that onclick on a link triggers opening something)

  1. Clicking left mouse down and not releasing causes the link to open after roughly 2 second
  2. Clicking left mouse down and moving it back and forth over the link causes many links to open

Note: if this behavior were to be unbound from the lazygit app side, this is where that would happen happen: https://github.com/jesseduffield/lazygit/blob/17d03ec8cb89d4c65fd129228164562a220abefb/pkg/gui/gui.go#L378

ChrisMcD1 avatar Dec 07 '25 01:12 ChrisMcD1

Created https://github.com/jesseduffield/gocui/pull/86 which gets rid of the main pain point that I have tagged as issue 2 above, the opening of hundreds of links. Issue 1, the opening of a the link after a second of holding the cursor still happens. I suspect this has something to do with the double-click behavior, but I'm not particularly invested in figuring that one out.

ChrisMcD1 avatar Dec 07 '25 01:12 ChrisMcD1

This was closed because https://github.com/jesseduffield/gocui/pull/86 was merged. That doesn't really fix it in lazygit yet, because we still need to update the gocui dependency in lazygit. I'll do that soon for other reasons.

stefanhaller avatar Dec 14 '25 13:12 stefanhaller