jesseduffield / lazygit

simple terminal UI for git commands
MIT License
47.94k stars 1.72k forks source link

Text background color turns blue when unstaging chunks #3664

Closed ghost-in-the-zsh closed 1 week ago

ghost-in-the-zsh commented 2 weeks ago

Description

When I stage a whole file and them jump into it to unstage selected chunks, the background color of the staged section turns blue. If you change which files you're looking at, their backgrounds are also blue.

Steps to Reproduce

  1. Go to section 2: Files - Worktrees - Submodules
  2. Find a file with changes and press <Space> to stage all of it
  3. Press <Enter> on it and move to the Staged changes section
  4. Press <Space> on some chunks to unstage them
  5. The previously hidden Unstaged changes section reappears and the unstaged text's background color is blue.

NOTE: See context. Not always reproducible via these steps; might be unrelated to (un)staging.

Expected behavior

Background colors don't change.

Screenshots

Screenshot from 2024-06-15 05-44-56

Version info:

Latest release (at the time of this writing):

$ lazygit --version
commit=6fcb7eb8bb616c170506312870b3bf15f3dbe37c, build date=2024-05-19T10:15:28Z, build source=binaryRelease, version=0.42.0, os=linux, arch=amd64, git version=2.43.0

Git:

$ git --version
git version 2.43.0

Additional context

The above steps are just one way in which I've triggered the issue. It doesn't always get triggered. A bit more messing around between (un)staging files and/or chunks also triggered it, with the background color remaining blue in both the staged and unstaged portions.

I'm speculating that it might have something to do with the staged/unstaged sections becoming hidden/visible. A bit more messing showed that the bg colors went back to normal by causing the whole section to be split by staging/unstaging some chunks.

You'll need to play with it. I just pulled another all-nighter and can't really dig any deeper.

stefanhaller commented 2 weeks ago

Thanks for the reproduction recipe. I've seen this several times myself, and it always drove me nuts, but I could never figure out how it happened. With your reproduction steps it was pretty easy to figure out.

Here's a PR that fixes it for me: #3667

(In the meantime, a workaround is to press tab twice.)

ghost-in-the-zsh commented 2 weeks ago

Sounds great. Thanks a lot for the tool and the follow-up.