From: Neil Brown Date: Fri, 11 May 2012 09:42:24 +0000 (+1000) Subject: Browser: improve decision on when to split window for merger view. X-Git-Tag: v0.9~10 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=7e5de26d5e0fc76738a196263083a0960301ce56;p=wiggle.git Browser: improve decision on when to split window for merger view. Now that we are tracking in_conflict in the broswer we "know" when we are in a conflict and so can only display the split window then, rather than keeping some hysteresis until we leave any changes behind. This makes large jumps ('N' 'P') display better. Also don't allow hunk headers to look like a 'wiggled' section, because they aren't really. Signed-off-by: NeilBrown --- diff --git a/vpatch.c b/vpatch.c index f323891..653cdb6 100644 --- a/vpatch.c +++ b/vpatch.c @@ -575,7 +575,9 @@ static int check_line(struct mpos pos, struct file fm, struct file fb, else if ((m[pos.p.m].type == AlreadyApplied || m[pos.p.m].type == Conflict)) rv |= CONFLICTED | CHANGES; - else if (m[pos.p.m].type == Extraneous) + else if (m[pos.p.m].type == Extraneous && + /* hunk headers don't count as wiggles */ + fb.list[m[pos.p.m].b].start[0] != '\0') rv |= WIGGLED; else if (m[pos.p.m].type == Unmatched) unmatched = 1; @@ -1312,12 +1314,13 @@ static void merge_window(struct plist *p, FILE *f, int reverse) if (mode == (ORIG|RESULT)) { int cmode = check_line(pos, fm, fb, fa, ci.merger, mode); - if (splitrow < 0 && (cmode & (WIGGLED|CONFLICTED))) { - splitrow = (rows+1)/2; - lastrow = splitrow - 1; - refresh = 1; - } - if (!curs.alt && splitrow >= 0 && !(cmode & CHANGES)) { + if (cmode & (WIGGLED | CONFLICTED)) { + if (splitrow < 0) { + splitrow = (rows+1)/2; + lastrow = splitrow - 1; + refresh = 1; + } + } else if (!curs.alt && splitrow >= 0) { splitrow = -1; lastrow = rows-1; refresh = 1;