Jeff King <[email protected]> writes:
> Unfortunately, I don't think there's an easy way to do what you want
> (show word-diffs but apply the full diff).
The current "word-diff" discards the information on where the lines
end, and it is pretty much hopeless/useless in the context of "add
-p". It would be a good addition to revamp it so that it keeps the
original lines in pre/post images but only colors/highlights the
byte ranges in such a way that (1) on a pre-image line, paint only
the byte range that do not appear in the post-image, and (2) on a
post-image line, paint only the byte range that do not appear in the
pre-image.
E.g. Given these two
diff --git a/1 b/2
index aa49234b68..1cd9f6b5fd 100644
--- a/1
+++ b/2
@@ -1,2 +1 @@
-a b c e
-f g i j
+a b d f g h
the current word-diff would give (I cannot do colors here, so I'll
upcase the colored letters):
@@ -1,2 +1 @@
a b C ED f g I JH
as the output, but if we produced
@@ -1,2 +1 @@
-a b C E
-f g I J
+a b D f g H
instead, then colored "add -p" would become easier to see.
And that would be useful outside the context of "add -p", which is a
huge plus.