diff --git a/pd/src/g_undo.c b/pd/src/g_undo.c index 450f9dc106d47be10e394def677947bd9f88012f..e7bb9991288b61b06fcbdc2c2a40d46f975b6eb2 100644 --- a/pd/src/g_undo.c +++ b/pd/src/g_undo.c @@ -50,7 +50,18 @@ t_undo_action *canvas_undo_add(t_canvas *x, int type, const char *name, { //fprintf(stderr,"canvas_undo_add %d\n", type); - /* Check for empty sequences? */ + if(UNDO_SEQUENCE_END == type + && x && x->u_last + && UNDO_SEQUENCE_START == x->u_last->type) + { + /* empty undo sequence...get rid of it */ + x->u_last = x->u_last->prev; + canvas_undo_rebranch(x); + x->u_last->next = 0; + canvas_undo_name = x->u_last->name; + gui_vmess("gui_undo_menu", "xss", x, x->u_last->name, "no"); + return 0; + } t_undo_action *a = canvas_undo_init(x); a->type = type; diff --git a/pd/src/g_undo.h b/pd/src/g_undo.h index 8abdd1943df2a016a766796942f250ba733110f2..05e4323c4c040b0b95e652b0474015a5c6a45d70 100644 --- a/pd/src/g_undo.h +++ b/pd/src/g_undo.h @@ -62,7 +62,7 @@ typedef enum struct _undo_action { t_canvas *x; /* canvas undo is associated with */ - t_undo_type type; /* defines what kind of data container it is */ + t_undo_type type; /* defines what kind of data container it is */ void *data; /* each action will have a different data container */ char *name; /* name of current action */ struct _undo_action *prev; /* previous undo action */