]> git.wh0rd.org Git - nano.git/commitdiff
2008-10-04 Chris Allegretta <chrisa@asty.org>
authorChris Allegretta <chrisa@asty.org>
Sat, 4 Oct 2008 11:10:11 +0000 (11:10 +0000)
committerChris Allegretta <chrisa@asty.org>
Sat, 4 Oct 2008 11:10:11 +0000 (11:10 +0000)
        * cut.c (Add_undo): Save last cut undo information so it can be used for next uncut, fixes
          Savannah bug 24183.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4338 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/text.c

index 98e9253994099d221131e91ced5757fba1495944..5f0f1321cd5cc5e6fc5e0e0112b82a992503c967 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-04 Chris Allegretta <chrisa@asty.org>
+       * cut.c (Add_undo): Save last cut undo information so it can be used for next uncut, fixes
+         Savannah bug 24183.
+
 GNU nano 2.1.6 - 2008.10.03
 2008-10-03 Pascal Gentil <pascal.gentil@univ-rennes1.fr>
        * fortran.nanorc: Sample python syntax highlighting file
index 407b7ecb2113938f61feb8dd4ebc761877a6ea94..97e1f1900fabfb6e48672350ca08ca4fc7895da3 100644 (file)
@@ -822,6 +822,7 @@ void add_undo(undo_type current_action)
     undo *u, *cutu;
     char *data;
     openfilestruct *fs = openfile;
+    static undo *last_cutu = NULL; /* Last thing we cut to set up the undo for uncut */
 
     /* Ugh, if we were called while cutting not-to-end, non-marked and on the same lineno,
        we need to  abort here */
@@ -896,22 +897,22 @@ void add_undo(undo_type current_action)
            u->mark_begin_x = openfile->mark_begin_x;
        }
        u->to_end = (current_action == CUTTOEND);
+       last_cutu = u;
        break;
     case UNCUT:
-       for (cutu = u; cutu != NULL && cutu->type != CUT; cutu = cutu->next)
-           ;
-       if (cutu->type == CUT) {
-           u->cutbuffer = cutu->cutbuffer;
-           u->cutbottom = cutu->cutbottom;
-           if (!cutu->mark_set)
-               u->linescut = cutu->linescut;
+       if (!last_cutu)
+           statusbar(_("Internal error: can't setup uncut.  Please save your work."));
+       else if (last_cutu->type == CUT) {
+           u->cutbuffer = last_cutu->cutbuffer;
+           u->cutbottom = last_cutu->cutbottom;
+           if (!last_cutu->mark_set)
+               u->linescut = last_cutu->linescut;
            else {
                filestruct *c;
                for (c = u->cutbuffer; c != NULL; c = c->next)
                    u->linescut++;
            }
-       } else
-           statusbar(_("Internal error: can't setup uncut.  Please save your work."));
+       }
        break;
     case OTHER:
        statusbar(_("Internal error: unknown type.  Please save your work."));