" m display 'merge' view",
" | display side-by-side view",
"",
+ " I toggle whether spaces are ignored",
+ " when matching text.",
" x toggle ignoring of current Changed",
" or Conflict item",
" X toggle ignored of all Change and",
NULL
};
+static char *toggle_ignore[] = {
+ "",
+ "You have modified the merge.",
+ "Toggling ignoring of spaces will discard changes.",
+ "Do you want to proceed?",
+ " Y = discard changes and toggle ignoring of spaces",
+ " N = keep changes, don't toggle",
+ NULL
+};
+
static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
int selftest, int ignore_blanks)
{
if (refresh >= 2) {
char buf[100];
clear();
- snprintf(buf, 100, "File: %s%s Mode: %s\n",
+ snprintf(buf, 100, "File: %s%s Mode: %s",
p->file, reverse ? " - reversed" : "", modename);
(void)attrset(A_BOLD);
mvaddstr(0, 0, buf);
- clrtoeol();
(void)attrset(A_NORMAL);
+ if (ignore_blanks)
+ addstr(" (ignoring blanks)");
+ clrtoeol();
refresh = 1;
}
if (row < 1 || row >= lastrow)
endwin();
return answer;
+ case 'I': /* Toggle ignoring of spaces */
+ if (changes) {
+ refresh = 2;
+ answer = help_window(toggle_ignore, NULL, 1);
+ if (answer <= 0)
+ break;
+ changes = 0;
+ }
+ free(fm.list);
+ free(fb.list);
+ free(fa.list);
+ free(csl1);
+ free(csl2);
+ free(ci.merger);
+ ignore_blanks = ignore_blanks ? 0 : IgnoreBlanks;
+ fm = split_stream(sm, ByWord | ignore_blanks);
+ fb = split_stream(sb, ByWord | ignore_blanks);
+ fa = split_stream(sa, ByWord | ignore_blanks);
+
+ if (ch)
+ csl1 = pdiff(fm, fb, ch);
+ else
+ csl1 = diff(fm, fb);
+ csl2 = diff_patch(fb, fa);
+
+ ci = make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0);
+ for (i = 0; ci.merger[i].type != End; i++)
+ ci.merger[i].oldtype = ci.merger[i].type;
+
+ {
+ int ln = pos.p.lineno;
+ pos.p.m = 0; /* merge node */
+ pos.p.s = 0; /* stream number */
+ pos.p.o = -1; /* offset */
+ pos.p.lineno = 1;
+ pos.state = 0;
+ next_mline(&pos, fm, fb, fa, ci.merger, mode);
+ memset(&curs, 0, sizeof(curs));
+ while (pos.p.lineno < ln && ci.merger[pos.p.m].type != End)
+ next_mline(&pos, fm, fb, fa, ci.merger, mode);
+ vpos = pos;
+ }
+ refresh = 2;
+ break;
+
case '/':
case 'S'-64:
/* incr search forward */
" prompt on exit to save the rest.",
" R Revert the current saved file to its original",
" content",
+ " I toggle whether spaces are ignored",
+ " when matching text.",
NULL
};
static char *saveall_msg = " %d file%s (of %d) have not been saved.";
clear(); (void)attrset(0);
attron(A_BOLD);
mvaddstr(0, 0, "Ch Wi Co Patched Files");
- move(2, 0);
attroff(A_BOLD);
+ if (ignore_blanks)
+ addstr(" (ignoring blanks)");
+ move(2, 0);
refresh = 1;
}
if (row < 1 || row >= rows)
}
break;
+ case 'I': /* Toggle ignoring blanks */
+ ignore_blanks = ignore_blanks ? 0 : IgnoreBlanks;
+ refresh = 2;
+ for (i = 0; i < *np; i++)
+ pl[i].calced = 0;
+ break;
+
case '?':
help_window(main_help, NULL, 0);
refresh = 2;