Index: trunk/src/libcschem/cnc_line.c =================================================================== --- trunk/src/libcschem/cnc_line.c (revision 2210) +++ trunk/src/libcschem/cnc_line.c (revision 2211) @@ -138,12 +138,22 @@ static void line_remove_alloc(csch_undo_remove_t *slot) { - TODO("if wirenet: remove connections the line is participating in, using util_wirenet.c"); } static void line_remove_redo(csch_undo_remove_t *slot) { + csch_cgrp_t *parent_wn = NULL; + + if (slot->side_effects) { + parent_wn = slot->obj->parent; + if ((parent_wn != NULL) && (parent_wn->role == CSCH_ROLE_WIRE_NET)) + parent_wn = parent_wn; + } + csch_cnc_common_remove_redo(slot, CSCH_REM_FROM_RTREE | CSCH_REM_FROM_PARENT | CSCH_REM_DEL_EMPTY_PARENT); + + if (parent_wn != NULL) + csch_wirenet_recalc_junctions(slot->sheet, parent_wn, NULL); } static void line_remove_undo(csch_undo_remove_t *slot) Index: trunk/src/libcschem/concrete.h =================================================================== --- trunk/src/libcschem/concrete.h (revision 2210) +++ trunk/src/libcschem/concrete.h (revision 2211) @@ -166,6 +166,7 @@ csch_coord_t x, y; unsigned mirx:1, miry:1; } xform; + unsigned wirenet_recalc_lock:1; vtl0_t aid; /* link to the abstract objects compiled from this group; zero or one in flat design but can be more in hierarchic */ }; Index: trunk/src/libcschem/operation.c =================================================================== --- trunk/src/libcschem/operation.c (revision 2210) +++ trunk/src/libcschem/operation.c (revision 2211) @@ -89,7 +89,9 @@ ops->remove_alloc(u); uundo_unfreeze_serial(&sheet->undo); + u->side_effects = 1; ops->remove_redo(u); + u->side_effects = 0; if (how & CSCH_REM_UNDOABLE) csch_undo_inc_serial(sheet); Index: trunk/src/libcschem/operation.h =================================================================== --- trunk/src/libcschem/operation.h (revision 2210) +++ trunk/src/libcschem/operation.h (revision 2211) @@ -34,6 +34,7 @@ csch_chdr_t *obj; csch_cgrp_t *parent; csch_sheet_t *sheet; + unsigned side_effects:1; /* whether side effects should be performed */ } csch_undo_remove_t; typedef struct csch_undo_remove_s csch_undo_create_t; Index: trunk/src/libcschem/util_wirenet.c =================================================================== --- trunk/src/libcschem/util_wirenet.c (revision 2210) +++ trunk/src/libcschem/util_wirenet.c (revision 2211) @@ -346,6 +346,11 @@ crmap_t map; htPo_entry_t *je; + if (wirenet->wirenet_recalc_lock) + return; + + wirenet->wirenet_recalc_lock = 1; + map_wirenet_crossings(&map, sheet, wirenet, 0, 0); rnd_trace("junctions:\n"); @@ -366,6 +371,7 @@ } map_uninit(&map); + wirenet->wirenet_recalc_lock = 0; } /* Recalculate junctions of a wirenet and remove the wirenet if it became empty */