Skip to content
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

🐛 diff render issue on interactive patch git add -p with Windows Terminal #328

Open
remysalim opened this issue Sep 21, 2020 · 5 comments

Comments

@remysalim
Copy link

remysalim commented Sep 21, 2020

Hi,
Using the sample configuration, I have an unreadable output under Windows Terminal 1.2.2381.0
Only the background color seems to be rendered, i.e copy/pasting shows no content?

To make things more complicated the terminal I'm spawning calls init.bat from cmder, so it might as well be a terminal emulator issue...

I'm using the patched version of less.exe, as recommended (although it doesn't make a difference for this particular issue)

~/.gitconfig

[interactive]
    diffFilter = delta --color-only

[delta]
    features = side-by-side line-numbers decorations
    whitespace-error-style = 22 reverse

[delta "decorations"]
    commit-decoration-style = bold yellow box ul
    file-style = bold yellow ul
    file-decoration-style = none

Outputs:
image

Without using delta
image

λ delta --version
delta 0.4.3
λ git --version
git version 2.28.0.windows.1
@remysalim remysalim reopened this Sep 21, 2020
@dandavison
Copy link
Owner

Hi @RemySphere, is delta working for you outside of the git add -p scenario? E.g. git diff, git show, etc.

If you pipe output from git to delta directly, does that look correct? git diff | delta

@remysalim
Copy link
Author

Before I only had core.pager = delta --dark set in my .gitconfig, and there were no apparent issue with my day-to-day use, except the one.

But indeed, now that I am fiddling with more features there are a few glitches here and there...
image

side-by-side is mostly ok, with occasional encoding errors
image

There is no visible difference when piping output from git to delta directly.
Side note, those encoding artifacts don't seem to occur in a WSL container, but the main "background only" issue still does, somehow

@stan-guer
Copy link

I wonder if it's related to the ^M carriage returns. Or perhaps it's an unrelated issue. I'm experiencing this in Linux/urxvt editing a file created with windows (running set ff? in vim return fileformat=dos). git diff works because it does not show the ^M. git add --patch shows only the background on lines with ^M. Running dos2unix on the file makes git add --patch with delta work properly again.

@remysalim
Copy link
Author

Ahem, probably related, git log is also pretty messed up with my configuration

image

@dandavison
Copy link
Owner

dandavison commented Oct 7, 2020

Thanks @voqv, @RemySphere, I am also seeing some behavior I don't expect (on MacOS):

  1. I create a file containing the letter a followed by a newline character.
  2. I commit the file
  3. I run unix2dos on the file
  4. Now, when I do git diff | delta the diff is rendered correctly, but when I do git diff (allowing git to invoke delta via core.pager), the added line (green) is empty:

(Note that cat is aliased to bat on my system)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants