Closed hadronized closed 4 years ago
Looks like it does that if I remove and modify a line. With modify only:
The algorithm for calculating intra-line highlights requires there to be the same number of lines added as removed (a modification is treated as one line added and one line removed).
To elaborate on this, the algorithm for intra-line highlights assumes that we are just dealing with modifications – we are not adding entirely new lines or deleting lines.
Therefore in a diff, which always lists the lines removed and then the lines added, the algorithm assumes each removed line is the "same" line as the corresponding added line. To calculate intra-line highlights, the algorithm compares the first removed line to the first added line; then the second removed line to the second added line; and so on.
Therefore if the number of removed lines is not the same as the number of added lines, we are not dealing with modifications only, so don't try to add intra-line highlights at all.
There are obviously edge cases, e.g. you modify a line and also add/remove an adjacent line. In which case, ideally, the modified line would have the intra-line highlights and the added/removed adjacent line would have the normal all green or all red colour. But dealing with these edge cases is too complex – most of the time things work very well ignoring them.
Copy that, thanks for the explanations. :)
Features: +acl +iconv +tui