jesseduffield / lazygit

simple terminal UI for git commands
MIT License
50.96k stars 1.79k forks source link

[?1h= in display #2621

Open mvolkmann opened 1 year ago

mvolkmann commented 1 year ago

Describe the bug

I see "[?1h=" in the display. See the attached screenshot with a red arrow pointing to it.

To Reproduce Steps to reproduce the behavior:

Just start lazygit in the directory of a repository that has changes.

Expected behavior

A clear and concise description of what you expected to happen.

I expect to not see those characters.

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2023-05-10 at 8 16 30 AM

Version info: Run lazygit --version and paste the result here

commit=, build date=, build source=homebrew, version=0.37.0, os=darwin, arch=arm64, git version=2.40.0

Run git --version and paste the result here

git version 2.40.0

mark2185 commented 1 year ago

If you are using a custom pager, please try disabling it and see if that helps.

mvolkmann commented 1 year ago

I am using the delta pager. That was the issue. I'll report it to them.

mvolkmann commented 1 year ago

@mark2185 I also configure the use of the delta pager in my .gitconfig file. When I run git diff I do not see those extra characters. So I'm thinking this may really be an issue in lazygit. I believe those extra characters are an ANSI escape sequence to position the cursor. Is there a place in lazygit where that exact escape sequence is being output?

mvolkmann commented 1 year ago

I see that "EnterKeypad" uses that escape sequence. It is used in many "term.go" files that are part of "tcell/v2/terminfo".

mvolkmann commented 1 year ago

I've worked with the delta pager maintainer today to verify that this is not an issue with that software. I'm definitely convinced that it is not a delta issue.

mark2185 commented 1 year ago

Oh yeah, I'm pretty sure it's due to lazygit or one of the dependencies, I just suggested to try and disable the pager to see if it's due to that, which we have now confirmed :)

jesseduffield commented 1 year ago

That escape sequence is being printed by gocui (the rendering package that Lazygit uses). Whenever gocui comes across an escape sequence it doesn't recognise, it prints it as text.

The file this happens in is vendor/github.com/jesseduffield/gocui/escape.go. That's in the vendor directory so if somebody wants to implement support for the escape sequence, they can do so in that file for the sake of testing it out, and then make the change in https://github.com/jesseduffield/gocui so that we can then bump gocui on our end.

wlamers commented 6 months ago

I have the same issue when using Delta as a diff viewer and using the .gitconfig config setting. It does not happen when I configure LazyGit to use Delta in it's own config.yml. But the I loose certain setting (e.g. line numbers). Anyone a clue how I can fix this without changing gocui?

I get:

[?1h
[?1l
stefanhaller commented 6 months ago

I have the same issue when using Delta as a diff viewer and using the .gitconfig config setting. It does not happen when I configure LazyGit to use Delta in it's own config.yml.

I don't understand this. How are you using delta in lazygit without setting it in config.yml? This shouldn't be possible.

Can you post the relevant sections of your .gitconfig and config.yml files?

But the I loose certain setting (e.g. line numbers).

If you set delta as a pager in lazygit, you still configure it in .gitconfig. For example, I have

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never

in my config.yml, and

[delta]
    line-numbers = true

in my .gitconfig; it shows line numbers just fine in lazygit.