Index: trunk/src/undo_old.c =================================================================== --- trunk/src/undo_old.c (revision 29027) +++ trunk/src/undo_old.c (revision 29028) @@ -410,7 +410,7 @@ void *ptr1, *ptr1e, *ptr2, *ptr3, *txt_save; int type; pcb_flag_t swap; - int must_redraw; + int must_redraw = 0, must_reclip = 0; unsigned long oldflg; /* lookup entry by ID */ @@ -422,16 +422,22 @@ ptr1e = ptr1; swap = obj->Flags; - must_redraw = 0; f1 = pcb_flag_mask(obj->Flags, ~DRAW_FLAGS); f2 = pcb_flag_mask(Entry->Data.Flags, ~DRAW_FLAGS); - if (!PCB_FLAG_EQ(f1, f2)) must_redraw = 1; + f1 = pcb_flag_mask(obj->Flags, ~CLIP_FLAGS); + f2 = pcb_flag_mask(Entry->Data.Flags, ~CLIP_FLAGS); + if (!PCB_FLAG_EQ(f1, f2)) + must_reclip = 1; + if (pcb_undo_and_draw && must_redraw && (ptr1e != NULL)) pcb_erase_obj(type, ptr1e, ptr2); + if (must_reclip) + pcb_poly_restore_to_poly(PCB->Data, obj->type, ptr1, ptr2); + if (obj->type == PCB_OBJ_TEXT) { oldflg = obj->Flags.f; pcb_text_flagchg_pre((pcb_text_t *)obj, Entry->Data.Flags.f, &txt_save); @@ -440,6 +446,9 @@ obj->Flags = Entry->Data.Flags; Entry->Data.Flags = swap; + if (must_reclip) + pcb_poly_clear_from_poly(PCB->Data, obj->type, ptr1, ptr2); + if (obj->type == PCB_OBJ_TEXT) pcb_text_flagchg_post((pcb_text_t *)obj, oldflg, &txt_save); Index: trunk/src/undo_old.h =================================================================== --- trunk/src/undo_old.h (revision 29027) +++ trunk/src/undo_old.h (revision 29028) @@ -36,6 +36,8 @@ #define DRAW_FLAGS (PCB_FLAG_RAT | PCB_FLAG_SELECTED \ | PCB_FLAG_HIDENAME | PCB_FLAG_HOLE | PCB_FLAG_OCTAGON | PCB_FLAG_FOUND | PCB_FLAG_CLEARLINE) +#define CLIP_FLAGS (PCB_FLAG_CLEARLINE | PCB_FLAG_CLEARPOLY | PCB_FLAG_CLEARPOLYPOLY) + /* different layers */ void pcb_undo_move_obj_to_remove(int, void *, void *, void *);