From 7e5de26d5e0fc76738a196263083a0960301ce56 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 11 May 2012 19:42:24 +1000 Subject: [PATCH] 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 --- vpatch.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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; -- 2.39.5