From: NeilBrown Date: Tue, 13 Nov 2012 00:16:09 +0000 (+1100) Subject: vpatch: fix check_line to stop at hunk headers. X-Git-Tag: v1.0~102 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=0db3a999746fa190868b4feed38d1f69cdb284f3;p=wiggle.git vpatch: fix check_line to stop at hunk headers. check_line() includes invisible bits because they could in some sense be part of 'this' line. It ignore hunk headers, but it really should stop at them, because nothing before could be related to this line. This fixes a problem where 'N' and 'P' would find hunk headers which isn't really helpful. Signed-off-by: NeilBrown --- diff --git a/vpatch.c b/vpatch.c index 48edb33..6274475 100644 --- a/vpatch.c +++ b/vpatch.c @@ -574,8 +574,12 @@ static int check_line(struct mpos pos, struct file fm, struct file fb, if (mode & (BEFORE|AFTER)) rv |= CHANGES; } else if (m[pos.p.m].type == Extraneous) { - /* hunk headers don't count as wiggles */ - if (fb.list[m[pos.p.m].b].start[0] != '\0') + if (fb.list[m[pos.p.m].b].start[0] == '\0') + /* hunk headers don't count as wiggles + * and nothing before a hunk header + * can possibly be part of this 'line' */ + break; + else rv |= WIGGLED; } else if (m[pos.p.m].type == Unmatched) unmatched = 1;