Skip to content

Select hunk (a) broken #4470

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

Closed
xuyangyuio opened this issue Apr 9, 2025 · 8 comments · Fixed by #4589
Closed

Select hunk (a) broken #4470

xuyangyuio opened this issue Apr 9, 2025 · 8 comments · Fixed by #4589
Labels
bug Something isn't working

Comments

@xuyangyuio
Copy link

xuyangyuio commented Apr 9, 2025

In the "Unstaged changes" pane, press a to select hunk, but the hunk is not correctly selected.

@xuyangyuio xuyangyuio added the bug Something isn't working label Apr 9, 2025
@ChrisMcD1
Copy link
Contributor

Can you give some more details about what steps you are taking to produce this? Particularly if you have configured a non-default pager.

Here is me prior to pressing a:

Image

and after pressing a

Image

which is expected behavior. I can then click <space> to confirm that I want to stage that hunk.

@xuyangyuio
Copy link
Author

I use delta, in my config: pager: delta --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"

The hunk is selected, but partial like:

Image

@stefanhaller
Copy link
Collaborator

I've seen this too. I think it happens for longer hunks, where the view needs to scroll so that the end of the hunk becomes visible. As far as I remember, this is only a visual problem, pressing space to stage the hunk should still work fine (not 100% sure on that).

I'll have a closer look when I find some time.

@wiraki
Copy link

wiraki commented May 6, 2025

I can confirm I see the same behavior. Indeed it seems to only be a visual bug for longer hunks, but staging still works fine. However, it is sometimes difficult to understand what will be considered as a hunk and what not due to this.

I imagine this has nothing to do with the custom pager since it is currently not used in the staging mode, but just in case, I am also using delta as the custom pager.

@santhosh-tekuri
Copy link

this is happening for me. I have delta configured for git. but not for lazygit

@adriangalilea
Copy link

adriangalilea commented May 27, 2025

I can confirm this bug happens even with NO configuration at all. Tested on macOS with lazygit v0.45.2.

Test setup:

  • Removed lazygit config entirely (no ~/.config/lazygit/config.yml)
  • Disabled git pager (git config --global core.pager "")
  • Disabled interactive.diffFilter

Results:

  • numbers.txt with non-contiguous changes: 'a' selects entire file instead of hunk
Image All gets staged upon pressing space Image
  • app.js with long functions: Visual selection highlight glitch
Image

But all gets staged upon pressing space
Image

  • test_hunk.py Visual selection highlight glitch,
Image

But this time stages fine.
Image

So this is definitely a core lazygit bug, not related to delta or any user configuration. The bug manifests differently depending on the file content and hunk structure.

@stefanhaller
Copy link
Collaborator

Thanks for the elaborate report Adrian, but we have a fix for this already (#4589), it just hasn't been merged yet. Please test it if you can build from source.

And btw, 0.45 is really old, do yourself a favor and update to the latest version. You are missing out on a ton of new enhancements and fixes.

@adriangalilea
Copy link

And btw, 0.45 is really old, do yourself a favor and update to the latest version. You are missing out on a ton of new enhancements and fixes.

Oh, I wasn't aware! Thanks for letting me know.

it just hasn't been merged yet

ETA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
6 participants