summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-10-14 18:23:31 (GMT)
committervincentdarley <vincentdarley>2003-10-14 18:23:31 (GMT)
commitdd08d357ebf5c18a2de038e6600bc9a1f6436be5 (patch)
treecc1475b28f0953253a92d4e9d00491b37ef39888 /generic/tclCmdMZ.c
parentb7c8b125de1f42a74d05bd5882afc2da0a88604a (diff)
downloadtcl-dd08d357ebf5c18a2de038e6600bc9a1f6436be5.zip
tcl-dd08d357ebf5c18a2de038e6600bc9a1f6436be5.tar.gz
tcl-dd08d357ebf5c18a2de038e6600bc9a1f6436be5.tar.bz2
regsub fix
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 463e0c5..2a78838 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.95 2003/10/14 15:44:52 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.96 2003/10/14 18:23:39 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -627,7 +627,7 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv)
match = Tcl_RegExpExecObj(interp, regExpr, objPtr, offset,
10 /* matches */, ((offset > 0 &&
- (Tcl_GetUniChar(objPtr,offset-1) != (Tcl_UniChar)'\n'))
+ (wstring[offset-1] != (Tcl_UniChar)'\n'))
? TCL_REG_NOTBOL : 0));
if (match < 0) {
@@ -722,6 +722,17 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv)
offset++;
} else {
offset += end;
+ if (start == end) {
+ /*
+ * We matched an empty string, which means we must go
+ * forward one more step so we don't match again at the
+ * same spot.
+ */
+ if (offset < wlen) {
+ Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1);
+ }
+ offset++;
+ }
}
if (!all) {
break;