]> git.neil.brown.name Git - wiggle.git/commitdiff
Browser: refine 'c' and 'x' commands.
authorNeilBrown <neilb@suse.de>
Fri, 23 Aug 2013 05:32:19 +0000 (15:32 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 23 Aug 2013 05:34:29 +0000 (15:34 +1000)
'x' will try to make text go away.
'c' will try to make text stay.
'X' will undo all such changes on the current line.

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

index 001bdf2bb9849d0dee7e68b3b5a07b87766e7b87..fb31947d65c6e6db0eda91953150c4fabe2e91fa 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -1238,8 +1238,7 @@ static char *merge_window_help[] = {
        " x                   toggle ignoring of current Changed,",
        "                     Conflict, or Unmatched item",
        " c                   toggle accepting of result of conflict",
-       " X                   toggle ignored of all Change, Conflict",
-       "                     and Unmatched items in current line",
+       " X                   Revert 'c' and 'x' changes on this line",
        " v                   Save the current merge and run the",
        "                     default editor on the file.",
        NULL
@@ -1344,7 +1343,6 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
        int lineno;
        int changes = 0; /* If any edits have been made to the merge */
        int answer;     /* answer to 'save changes?' question */
-       int do_mark;
        char *tempname;
        struct elmnt e;
        char search[80];  /* string we are searching for */
@@ -2260,9 +2258,10 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
                        break;
 
                case 'c': /* Toggle accepting of conflict.
-                          * A 'Conflict' becomes 'Changed'
+                          * A 'Conflict' or 'Extraneous' becomes 'Changed'
                           */
-                       if (ci.merger[curs.pos.m].oldtype != Conflict)
+                       if (ci.merger[curs.pos.m].oldtype != Conflict &&
+                           ci.merger[curs.pos.m].oldtype != Extraneous)
                                break;
 
                        if (ci.merger[curs.pos.m].type == Changed)
@@ -2276,39 +2275,11 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
                        changes = 1;
                        break;
 
-               case 'X': /* toggle where all Conflicts and Changeds
-                          * in the current line are marked Unchanged.
-                          * If any are not mark, mark them all, else
-                          * un-mark them all.
-                          */
-                       tpos = pos;
-                       do_mark = 0;
-                       do {
-                               if ((ci.merger[tpos.p.m].oldtype == Conflict ||
-                                    ci.merger[tpos.p.m].oldtype == Changed ||
-                                    ci.merger[tpos.p.m].oldtype == Unmatched)
-                                   && (ci.merger[tpos.p.m].type ==
-                                       ci.merger[tpos.p.m].oldtype))
-                                       do_mark = 1;
-                               e = prev_melmnt(&tpos.p, fm, fb, fa, ci.merger);
-                               if (tpos.p.m < 0)
-                                       break;
-                       } while (!ends_line(e) ||
-                                visible(mode & (RESULT|AFTER), ci.merger, &tpos) < 0);
+               case 'X': /* Reset all changes on the current line */
                        tpos = pos;
                        do {
-                               if (ci.merger[tpos.p.m].oldtype == Conflict ||
-                                   ci.merger[tpos.p.m].oldtype == Changed ||
-                                   ci.merger[tpos.p.m].oldtype == Unmatched) {
-                                       next = Unchanged;
-                                       if (ci.merger[tpos.p.m].oldtype == Unmatched)
-                                               next = Changed;
-                                       if (do_mark)
-                                               ci.merger[tpos.p.m].type = next;
-                                       else
-                                               ci.merger[tpos.p.m].type =
-                                                       ci.merger[tpos.p.m].oldtype;
-                               }
+                               ci.merger[tpos.p.m].type =
+                                       ci.merger[tpos.p.m].oldtype;
                                e = prev_melmnt(&tpos.p, fm, fb, fa, ci.merger);
                                if (tpos.p.m < 0)
                                        break;
index 2a382a7b7cd0edbaeeaa6a3e9f1851a3e79af06a..ac700bacc78bc7b111ef1399243be72395d0fbfb 100644 (file)
--- a/wiggle.1
+++ b/wiggle.1
@@ -534,30 +534,18 @@ experimentations should help.
 .P
 A limited amount of editing is permitted while in
 .B browse
-mode.  Currently any Conflict or Changed section can be converted to
-Unchanged by using the
-.B x
-key (lower case), or all the Conflict and Changes sections in a line
-can be converted to Unchanged.
+mode.  Currently text that is unwanted can be discarded with
+.BR x .
+This will convert a Conflict or Change to Unchanged, and an Unmatched
+to Changed (which effectively changes it to the empty string).
+Similarly a text can be marked as wanted with
+.BR c .
+This will convert a Conflict or Extraneous to Changed.  Using the same
+key again will revert the change.
+.P
+Finally, the uppercase
 .B X
-(upper case).  The effect can be toggled by pressing
-.B x
-or
-.B X
-again.
-.P
-A Conflict section can also be converted to Change (so the result is
-accepted even though there wasn't a proper match) with the (lower
-case)
-.B c
-key.  Pressing
-.B c
-effects a toggle.
-.P
-If you make any changes, then wiggle will ask you if you want
-to save the changes, even if
-.B \-\-replace
-was not given.
+will revert all changes on the current line.
 .P
 To make more sweeping changes you can use
 .B v
@@ -566,6 +554,11 @@ which runs an editor, preferring
 or
 .B $EDITOR
 if they are set in the environment.
+.P
+If you make any changes, then wiggle will ask you if you want
+to save the changes, even if
+.B \-\-replace
+was not given.
 .SH WARNING
 Caution should always be exercised when applying a rejected patch with
 .IR wiggle .