summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclMain.c34
2 files changed, 23 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 4be3b60..5f39550 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-29 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclMain.c (Tcl_Main, StdinProc): Append newline only to
+ incomplete scripts as part of multi-line script construction. Do
+ not add an extra trailing newline to the complete script. [Bug 833150]
+
2004-03-28 Miguel Sofer <msofer@users.sf.net>
* generic/tclCompile.c (TclCompileScript): corrected possible
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 19cf5d5..80eb200 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMain.c,v 1.23 2004/03/19 18:33:52 kennykb Exp $
+ * RCS: @(#) $Id: tclMain.c,v 1.24 2004/03/29 15:47:31 dgp Exp $
*/
#include "tcl.h"
@@ -455,17 +455,17 @@ Tcl_Main(argc, argv, appInitProc)
break;
}
- /*
- * Add the newline removed by Tcl_GetsObj back to the string.
- */
-
- if (Tcl_IsShared(commandPtr)) {
- Tcl_DecrRefCount(commandPtr);
- commandPtr = Tcl_DuplicateObj(commandPtr);
- Tcl_IncrRefCount(commandPtr);
- }
- Tcl_AppendToObj(commandPtr, "\n", 1);
if (!TclObjCommandComplete(commandPtr)) {
+ /*
+ * Add the newline removed by Tcl_GetsObj back to the string.
+ */
+
+ if (Tcl_IsShared(commandPtr)) {
+ Tcl_DecrRefCount(commandPtr);
+ commandPtr = Tcl_DuplicateObj(commandPtr);
+ Tcl_IncrRefCount(commandPtr);
+ }
+ Tcl_AppendToObj(commandPtr, "\n", 1);
prompt = PROMPT_CONTINUE;
continue;
}
@@ -683,13 +683,13 @@ StdinProc(clientData, mask)
return;
}
- if (Tcl_IsShared(commandPtr)) {
- Tcl_DecrRefCount(commandPtr);
- commandPtr = Tcl_DuplicateObj(commandPtr);
- Tcl_IncrRefCount(commandPtr);
- }
- Tcl_AppendToObj(commandPtr, "\n", 1);
if (!TclObjCommandComplete(commandPtr)) {
+ if (Tcl_IsShared(commandPtr)) {
+ Tcl_DecrRefCount(commandPtr);
+ commandPtr = Tcl_DuplicateObj(commandPtr);
+ Tcl_IncrRefCount(commandPtr);
+ }
+ Tcl_AppendToObj(commandPtr, "\n", 1);
isPtr->prompt = PROMPT_CONTINUE;
goto prompt;
}