]> git.neil.brown.name Git - wiggle.git/commitdiff
vpatch: add 'C' command to go to next conflicted hunk.
authorNeilBrown <neilb@suse.de>
Wed, 14 Nov 2012 23:23:59 +0000 (10:23 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 14 Nov 2012 23:23:59 +0000 (10:23 +1100)
This makes it easy to find conflicts.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch.c

index 975b4a3496d259900fc96d653d2e3c86f3f2d884..ee31ba161ecdce2631bada8d8e9c1c981708f73f 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -1188,6 +1188,7 @@ static char *merge_window_help[] = {
        " ESC-v   BACKSPC     page up",
        " N                   go to next patch chunk",
        " P                   go to previous patch chunk",
+       " C                   go to next conflicted chunk",
        " O                   move cursor to alternate pane",
        " ^ control-A         go to start of line",
        " $ control-E         go to end of line",
@@ -1814,6 +1815,25 @@ static int merge_window(struct plist *p, FILE *f, int reverse)
                                 && ci.merger[tpos.p.m].type != End);
 
                        break;
+               case 'C':
+                       /* Next conflict */
+                       tpos = pos; row--;
+                       do {
+                               pos = tpos; row++;
+                               next_mline(&tpos, fm, fb, fa, ci.merger, mmode);
+                       } while (!(check_line(pos, fm, fb, fa, ci.merger, mmode)
+                                  & CONFLICTED) == 0
+                                && ci.merger[tpos.p.m].type != End);
+                       tpos = pos; row--;
+                       do {
+                               pos = tpos; row++;
+                               next_mline(&tpos, fm, fb, fa, ci.merger, mmode);
+                       } while ((check_line(pos, fm, fb, fa, ci.merger, mmode)
+                                 & CONFLICTED) == 0
+                                && ci.merger[tpos.p.m].type != End);
+
+                       break;
+
                case 'P':
                        /* Previous diff */
                        tpos = pos; row++;