jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.65k stars 1.84k forks source link

Mouse hover follows delta Hyperlinks #3928

Open mayorbyrne opened 1 month ago

mayorbyrne commented 1 month ago

Describe the bug I'm seeing some unintended behavior with regards to hyperlinks in delta. They work as expected on first click, but after that it appears to follow every link by simply hovering over the hyperlink.

To Reproduce

  1. I click a hyperlink in a diff, which opens the file in the editor
  2. close the file
  3. Now simply hovering over a link in the diff opens the file again
  4. This behavior appears to resolve itself after the terminal window loses focus

Expected behavior Hyperlinks should only be followed on an actual mouse click.

Version info: commit=, build date=, build source=homebrew, version=0.44.1, os=darwin, arch=arm64, git version=2.39.5 (Apple Git-154) git version 2.39.5 (Apple Git-154)

Additional context I'm using the suggested config

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"

Screen Recording of the issue

lazygit

stefanhaller commented 3 weeks ago

Are you using WezTerm? I tried to reproduce this with all the terminal emulators that I could find on my machine, and only WezTerm showed this behavior. It works fine in Terminal.app, iTerm, Kitty, Alacritty, and VS Code's integrated terminal.

I think this is a bug in WezTerm. What seems to happen is that WezTerm sends the mouse-down event to lazygit, and then lazygit suspends to the background in order to launch vim; the mouse-up event is never seen by lazygit. Then, after lazygit resumes, the mouse-move events that WezTerm sends to lazygit still contain the "mouse-button-1-is-pressed" flag. That's the bug.