From 0dd399b6efbbbcd6b5fc983a7525db6adbc58674 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Thu, 2 Aug 2012 16:54:56 -0400
Subject: [PATCH] undo bug fix

---
 src/g_editor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/g_editor.c b/src/g_editor.c
index d159bf1c4..ca4551e06 100644
--- a/src/g_editor.c
+++ b/src/g_editor.c
@@ -3343,7 +3343,7 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy)
 	//fprintf(stderr,"canvas_displaceselection %d %d\n", dx, dy);
     t_selection *y;
     int resortin = 0, resortout = 0;
-    if (!canvas_undo_already_set_move)
+    if (!canvas_undo_already_set_move && x->gl_editor->e_selection)
     {
         //canvas_setundo(x, canvas_undo_move, canvas_undo_set_move(x, 1),
         //    "motion");
@@ -4323,6 +4323,7 @@ static void canvas_paste_atmouse(t_canvas *x)
 		}
 	}
 	/* redraw objects */
+	canvas_undo_already_set_move = 1;
     canvas_displaceselection(x, (x->gl_editor->e_xwas)+5-x1, (x->gl_editor->e_ywas)-y1);
 	canvas_startmotion(x);
 }
-- 
GitLab