From 18e7960200db745bdfb8936ed33e4cc7cafad557 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 9 Apr 2020 19:13:48 +0000 Subject: Same trouble fixed the same way in Tcl_AppendElement(). --- generic/tclResult.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/generic/tclResult.c b/generic/tclResult.c index 7b58d44..1b9d5c9 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -704,6 +704,7 @@ Tcl_AppendElement( char *dst; int size; int flags; + int quoteHash = 1; /* * If the string result is empty, move the object result to the string @@ -740,9 +741,17 @@ Tcl_AppendElement( * then this element will not lead a list, and need not have it's * leading '#' quoted. */ - + quoteHash = 0; + } else { + while ((--dst >= iPtr->appendResult) && TclIsSpaceProcM(*dst)) { + } + quoteHash = !TclNeedSpace(iPtr->appendResult, dst+1); + } + dst = iPtr->appendResult + iPtr->appendUsed; + if (!quoteHash) { flags |= TCL_DONT_QUOTE_HASH; } + iPtr->appendUsed += Tcl_ConvertElement(element, dst, flags); } -- cgit v0.12