From 2d1cf8435a6e72c18031064911f5ef789752d6fd Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 24 Mar 2021 20:20:55 -0400 Subject: [PATCH] Corrected the list produced by "what -listall" to have the intended nesting. Corrected the "select visible" command, which got broken during the modifications. --- commands/CmdRS.c | 3 +-- commands/CmdTZ.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/commands/CmdRS.c b/commands/CmdRS.c index 370380d9..992987c0 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -633,8 +633,7 @@ cmdSelectArea(layers, less, option) TTMaskClearType(&mask, i); } } - else - SelectArea(&scx, &mask, crec->dbw_bitmask); + SelectArea(&scx, &mask, crec->dbw_bitmask); } /* diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index 489a0652..7c0395b3 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -913,7 +913,7 @@ CmdWhat(w, cmd) CellUse *CheckUse; #ifdef MAGIC_WRAPPER - Tcl_Obj *lobj, *paintobj, *paintcellobj, *labelobj, *cellobj; + Tcl_Obj *lobj, *paintobj, *paintcellobj, *celllistobj, *labelobj, *cellobj; extern int cmdWhatCellListFunc(); #endif @@ -928,10 +928,7 @@ CmdWhat(w, cmd) if (!strncmp(cmd->tx_argv[locargc - 1], "-list", 5)) { if (!strncmp(cmd->tx_argv[locargc - 1], "-listall", 8)) - { doListAll = TRUE; - paintcellobj = Tcl_NewListObj(0, NULL); - } else doList = TRUE; locargc--; @@ -1015,6 +1012,8 @@ CmdWhat(w, cmd) TTMaskSetOnlyType(&maskBits, i); if (DBIsContact(i)) DBMaskAddStacking(&maskBits); + if (doListAll) paintcellobj = Tcl_NewListObj(0, NULL); + /* Search selection for tiles of this type, then */ /* call cmdFindWhatTileFunc() to search the cell */ /* def in the area of that tile to determine what */ @@ -1038,12 +1037,16 @@ CmdWhat(w, cmd) } else { - Tcl_ListObjAppendElement(magicinterp, paintobj, + Tcl_ListObjAppendElement(magicinterp, paintcellobj, Tcl_NewStringObj(DBTypeLongName(i), -1)); + celllistobj = Tcl_NewListObj(0, NULL); for (lidp = lid; lidp; lidp = lidp->lid_next) - Tcl_ListObjAppendElement(magicinterp, paintcellobj, + Tcl_ListObjAppendElement(magicinterp, celllistobj, Tcl_NewStringObj(lidp->lid_name, -1)); + + Tcl_ListObjAppendElement(magicinterp, paintcellobj, + celllistobj); } while (lid != NULL) @@ -1051,11 +1054,12 @@ CmdWhat(w, cmd) freeMagic(lid); lid = lid->lid_next; } + if (doListAll) + Tcl_ListObjAppendElement(magicinterp, paintobj, + paintcellobj); } } EditCellUse = saveUse; - if (doListAll) - Tcl_ListObjAppendElement(magicinterp, paintobj, paintcellobj); } else