From d38186745ac36b595ab9a20ecc6c27422ff33ce2 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 15 Nov 2012 14:07:09 +1100 Subject: [PATCH] vpatch: add X command to ignore all changes in the line. 'X' will toggle the ignoring of all Conflict and Changeds in the current line. Signed-off-by: NeilBrown --- vpatch.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/vpatch.c b/vpatch.c index e7e37f9..ec7f57c 100644 --- a/vpatch.c +++ b/vpatch.c @@ -1212,6 +1212,11 @@ static char *merge_window_help[] = { " d display 'diff' or 'patch' view", " m display 'merge' view", " | display side-by-side view", + "", + " x toggle ignoring of current Changed", + " or Conflict item", + " X toggle ignored of all Change and", + " Conflict items in current line", NULL }; static char *save_query[] = { @@ -1273,6 +1278,8 @@ static int merge_window(struct plist *p, FILE *f, int reverse) tnum; int changes = 0; /* If any edits have been made to the merge */ int answer; /* answer to 'save changes?' question */ + int do_ignore; + struct elmnt e; char search[80]; /* string we are searching for */ unsigned int searchlen = 0; int search_notfound = 0; @@ -2040,6 +2047,34 @@ static int merge_window(struct plist *p, FILE *f, int reverse) } break; + case 'X': /* toggle 'ignored' for all Conflicts and Changeds + * in the current line. + * If any are not ignored, ignore them all, else + * un-ignore them all. + */ + tpos = pos; + do_ignore = 0; + do { + if ((ci.merger[tpos.p.m].type == Conflict || + ci.merger[tpos.p.m].type == Changed) + && ci.merger[tpos.p.m].ignored == 0) + do_ignore = 1; + e = prev_melmnt(&tpos.p, fm, fb, fa, ci.merger); + } while (!ends_mline(e) || + visible(mode & (RESULT|AFTER), ci.merger, &tpos) < 0); + tpos = pos; + do { + if (ci.merger[tpos.p.m].type == Conflict || + ci.merger[tpos.p.m].type == Changed) + ci.merger[tpos.p.m].ignored = do_ignore; + e = prev_melmnt(&tpos.p, fm, fb, fa, ci.merger); + } while (!ends_mline(e) || + visible(mode & (RESULT|AFTER), ci.merger, &tpos) < 0); + isolate_conflicts(fm, fb, fa, csl1, csl2, 0, ci.merger, 0); + refresh = 1; + changes = 1; + break; + case '?': help_window(modehelp, merge_window_help, 0); refresh = 2; -- 2.39.5