Found another couple of places where the environment variable

HOME was checked but no check was made on whether or not the
result was NULL.  This resolves issue #490 in the github issue
tracker.

Also:  Modified the way that "select visible" works to check if
labels and/or cells are rendered visible in the window.  If not,
then they are not selected.  Previously, cell instances and
labels would be selected whether or not they were visible.
This resolves issue #503 in the github issue tracker.
This commit is contained in:
R. Timothy Edwards 2026-05-13 09:46:21 -04:00
parent e5a6cf0df9
commit db224105a7
3 changed files with 20 additions and 12 deletions

View File

@ -635,9 +635,17 @@ cmdSelectArea(
int i;
for (i = 0; i < DBNumUserLayers; i++)
{
if((TTMaskHasType(&mask, i)) && !(TTMaskHasType(&crec->dbw_visibleLayers, i)))
if ((TTMaskHasType(&mask, i)) &&
!(TTMaskHasType(&crec->dbw_visibleLayers, i)))
TTMaskClearType(&mask, i);
}
/* Remove L_CELL and L_LABEL if crec->dbw_flags indicates that
* they are not visible in the layout window.
*/
if (!(crec->dbw_flags & DBW_SEELABELS)) TTMaskClearType(&mask, L_LABEL);
if (!(crec->dbw_flags & DBW_SEECELLS)) TTMaskClearType(&mask, L_CELL);
}
SelectArea(&scx, &mask, crec->dbw_bitmask, globmatch);
}
@ -1027,7 +1035,7 @@ CmdSelect(
/*--------------------------------------------------------------------
* Select everything under the box, perhaps looking only at
* particular layers, but only if its visible.
* particular layers, but only if it's visible.
*--------------------------------------------------------------------
*/

View File

@ -2016,8 +2016,8 @@ badTransform:
if ((cellDef->cd_file != NULL) && (cellDef->cd_file[0] == '/'))
{
char *homedir = getenv("HOME");
if (strncmp(cellDef->cd_file, homedir, strlen(homedir)) ||
*(cellDef->cd_file + strlen(homedir)) != '/')
if (homedir && (strncmp(cellDef->cd_file, homedir, strlen(homedir)) ||
*(cellDef->cd_file + strlen(homedir)) != '/'))
{
char *homeroot = strrchr(homedir, '/');
int rootlen = (int)(homeroot - homedir) + 1;
@ -2060,9 +2060,10 @@ badTransform:
if (*pathptr == '~')
{
char *homedir = getenv("HOME");
if (!strncmp(subCellDef->cd_file, homedir, strlen(homedir))
&& (!strcmp(subCellDef->cd_file + strlen(homedir),
pathptr + 1)))
if (homedir && (!strncmp(subCellDef->cd_file, homedir,
strlen(homedir)) &&
(!strcmp(subCellDef->cd_file + strlen(homedir),
pathptr + 1))))
pathOK = TRUE;
}
else if (!strcmp(cwddir, pathptr)) pathOK = TRUE;
@ -2254,9 +2255,9 @@ badTransform:
/* Check if the path is the same as the current directory */
char *homedir = getenv("HOME");
if (!strncmp(cwddir, homedir, strlen(homedir))
if (homedir && (!strncmp(cwddir, homedir, strlen(homedir))
&& (!strcmp(cwddir + strlen(homedir),
pathptr + 1)))
pathptr + 1))))
pathOK = TRUE;
}
else if (!strcmp(cwddir, pathptr)) pathOK = TRUE;

View File

@ -471,12 +471,11 @@ SelectArea(scx, types, xMask, globmatch)
if (TTMaskHasType(types, L_LABEL))
{
if (globmatch != NULL)
DBCellCopyGlobLabels(scx, &DBAllTypeBits, xMask, SelectUse, &labelArea,
DBCellCopyGlobLabels(scx, types, xMask, SelectUse, &labelArea,
globmatch);
else
DBCellCopyAllLabels(scx, &DBAllTypeBits, xMask, SelectUse, &labelArea);
DBCellCopyAllLabels(scx, types, xMask, SelectUse, &labelArea);
}
else (void) DBCellCopyAllLabels(scx, types, xMask, SelectUse, &labelArea);
/* Select cell uses. */