From b8a3e58eb3659bd1aed9d5eb0afecfda61adbe42 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Tue, 12 Mar 2013 14:04:49 -0400
Subject: [PATCH] fixed erroneous undo behavior after cutting two objects in a
 row

---
 pd/src/g_editor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 70478b552..ddfeef6e4 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -729,7 +729,7 @@ void *canvas_undo_set_cut(t_canvas *x, int mode)
     }
     else if (mode == UCUT_CUT)
     {
-        buf->u_objectbuf = 0;
+        buf->u_objectbuf = canvas_docopy(x);
     }
     else if (mode == UCUT_CLEAR)
     {
@@ -745,7 +745,7 @@ void *canvas_undo_set_cut(t_canvas *x, int mode)
 			{
 				if (glist_isselected(x, y)) {
 					buf->p_a[i] = j;
-					i++; 
+					i++;
 				}
 				j++;
 			}
@@ -768,7 +768,7 @@ void canvas_undo_cut(t_canvas *x, void *z, int action)
 		//fprintf(stderr,"UNDO_UNDO\n");
         if (mode == UCUT_CUT) {
 			//fprintf(stderr, "UCUT_CUT\n");
-            canvas_dopaste(x, copy_binbuf);
+            canvas_dopaste(x, buf->u_objectbuf);
 		}
         else if (mode == UCUT_CLEAR) {
 			//fprintf(stderr, "UCUT_CLEAR\n");
-- 
GitLab