Corrected an error in which the "select" command returns the name

of an instance with double-escaped brackets if the instance name
contains brackets.  This then undermines the use of the backslash
escape and causes the interpreter to raise an error instead of
printing the name.
This commit is contained in:
Tim Edwards 2021-02-18 13:05:29 -05:00
parent 1f698aa6ee
commit 59b021af73
2 changed files with 9 additions and 2 deletions

View File

@ -1 +1 @@
8.3.128
8.3.129

View File

@ -819,7 +819,7 @@ CmdSelect(w, cmd)
* also used to step through multiple uses.
*/
static bool lessCycle = FALSE, lessCellCycle = FALSE;
char path[200], *printPath, **msg, **optionArgs, *feedtext;
char path[200], *printPath, **msg, **optionArgs, *feedtext, *pstr;
TerminalPath tpath;
CellUse *use;
CellDef *rootBoxDef;
@ -1526,6 +1526,13 @@ Okay:
DBWSetBox(scx.scx_use->cu_def, &r);
#ifdef MAGIC_WRAPPER
/* Remove any backslash escapes so that Tcl_escape() doesn't
* double-escape them.
*/
for (pstr = printPath; *pstr != '\0';)
if ((*pstr == '\\') && ((*(pstr + 1) == '[') || (*(pstr + 1) == ']')))
memmove(pstr, pstr + 1, 1 + strlen(pstr + 1));
else pstr++;
tclstr = Tcl_escape(printPath);
Tcl_SetResult(magicinterp, tclstr, TCL_DYNAMIC);
#else