diff --git a/VERSION b/VERSION index 8db3b356..c8e7cc7e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.144 +8.3.145 diff --git a/select/selOps.c b/select/selOps.c index 7eb2f9a8..e71ed7ce 100644 --- a/select/selOps.c +++ b/select/selOps.c @@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" @@ -717,6 +718,43 @@ SelectShort(char *lab1, char *lab2) destlab = selLabel; } + /* Was nothing selected? Then run the equivalent of "goto lab1 ; select net */ + if (srclab == NULL && destlab == NULL) + { + CellUse *use; + TileType ttype; + Rect rect; + SearchContext scx; + MagWindow *window; + DBWclientRec *crec; + int windowMask; + + window = ToolGetBoxWindow(&rect, &windowMask); + if (!window) return NULL; + + use = (CellUse *)window->w_surfaceID; + ttype = CmdFindNetProc(lab1, use, &rect, FALSE); + if (ttype == TT_SPACE) return NULL; + + bzero(&scx, sizeof(SearchContext)); + scx.scx_use = use; + scx.scx_trans = GeoIdentityTransform; + scx.scx_area = rect; + crec = (DBWclientRec *)window->w_clientData; + + SelectNet(&scx, ttype, crec->dbw_bitmask, (Rect *)NULL, FALSE); + + for (selLabel = SelectDef->cd_labels; selLabel != NULL; selLabel = + selLabel->lab_next) + { + if ((srclab == NULL) && Match(lab1, selLabel->lab_text)) + srclab = selLabel; + + if ((destlab == NULL) && Match(lab2, selLabel->lab_text)) + destlab = selLabel; + } + } + /* Must be able to find both labels */ if (srclab == NULL || destlab == NULL) return NULL;