Skip to content
Snippets Groups Projects
Commit f325d8c8 authored by Guillem Bartrina's avatar Guillem Bartrina
Browse files

delete empty sequence if found

parent 4bd6aac1
No related merge requests found
...@@ -50,7 +50,18 @@ t_undo_action *canvas_undo_add(t_canvas *x, int type, const char *name, ...@@ -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); //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); t_undo_action *a = canvas_undo_init(x);
a->type = type; a->type = type;
......
...@@ -62,7 +62,7 @@ typedef enum ...@@ -62,7 +62,7 @@ typedef enum
struct _undo_action struct _undo_action
{ {
t_canvas *x; /* canvas undo is associated with */ 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 */ void *data; /* each action will have a different data container */
char *name; /* name of current action */ char *name; /* name of current action */
struct _undo_action *prev; /* previous undo action */ struct _undo_action *prev; /* previous undo action */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment