diff: fix -B with single line changes
authorAaro Koskinen <aaro.koskinen@iki.fi>
Thu, 30 Jul 2015 20:13:25 +0000 (23:13 +0300)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 31 Jul 2015 14:50:49 +0000 (16:50 +0200)
Fix -B with single line changes. They were always ignored regardless
if they were blank or not.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
editors/diff.c

index cf14b1d0321da688c3aa0737201e4d5036fd0362..e0adcee590a3b0ae47f28cfaf6680537a78ef42a 100644 (file)
@@ -658,8 +658,8 @@ static bool diff(FILE* fp[2], char *file[2])
                                }
 
                                for (j = 0; j < 2; j++)
-                                       for (k = v[j].a; k < v[j].b; k++)
-                                               nonempty |= (ix[j][k+1] - ix[j][k] != 1);
+                                       for (k = v[j].a; k <= v[j].b; k++)
+                                               nonempty |= (ix[j][k] - ix[j][k - 1] != 1);
 
                                vec = xrealloc_vector(vec, 6, ++idx);
                                memcpy(vec[idx], v, sizeof(v));