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

🐛 Wrong highlighting #439

Open
ahmadie opened this issue Dec 8, 2020 · 6 comments
Open

🐛 Wrong highlighting #439

ahmadie opened this issue Dec 8, 2020 · 6 comments

Comments

@ahmadie
Copy link

ahmadie commented Dec 8, 2020

2020-12-09T02:06:24,595076411+09:00
2020-12-09T02:06:04,087539395+09:00

Show row diff vs delta diff, clearly something is wrong, I also stashed every thing so if you need more info from the command line to please advice.

Delta --version 0.4.4

@dandavison
Copy link
Owner

Thanks @ahmadie, this looks like an interesting one. Could you post the raw diff that's producing this as a text comment?

@ahmadie
Copy link
Author

ahmadie commented Dec 9, 2020

config.txt
config-after.txt

//could run using hope it helps =D
git diff --no-index config.txt config-after.txt

@dandavison
Copy link
Owner

Thanks!

@waldyrious
Copy link
Contributor

@dandavison would it make sense to merge this with #246 so all similar issues can be tracked in the same place?

@ElieGouzien
Copy link

Just a remark : here diffr is doing the job perfectly:
diffr

I usually prefer the algorithm used by diffr than the one of delta as it is more precise, especially when a large block have been moved and modified (sometime even too much, and it would benefit from a threshold on the portion of modified words to stop considering word by word diff and show the whole line changed).

Maybe diffr could be used in delta as a library (it is also in Rust and the interface and library are well separated).

@cben
Copy link

cben commented Jun 14, 2023

This is most likely same as the situation in #522 (comment), discussed in more detail on #13, and now fixable by configuring colors.

When the change is "large" enough (--max-line-distance), delta stops emphasizing parts and just colors uniformly (plus-style/minus-style).
And that style defaults same as non-emph parts, which matches GitHub etc. and has benefit of maximizing fg/bg contrast when you have to read the whole old & new code anyway 👍
The trouble is that delta makes that decision line-by-line 👎, allowing confusing situations like this. It'd be fine if whole subhunk had emphasis or none, but single lines combined with default colors is IMHO a bug.

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

5 participants