summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-10-14 18:21:59 (GMT)
committervincentdarley <vincentdarley>2003-10-14 18:21:59 (GMT)
commit0281176be42fbf8cd519c17208041ba5fcf8b193 (patch)
tree23e080c3df14c525a9db3c578e15e105fb1816c1 /generic
parentc18947675711693a12a4d8f933281f357bbab984 (diff)
downloadtcl-0281176be42fbf8cd519c17208041ba5fcf8b193.zip
tcl-0281176be42fbf8cd519c17208041ba5fcf8b193.tar.gz
tcl-0281176be42fbf8cd519c17208041ba5fcf8b193.tar.bz2
regsub fix
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdMZ.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index eac4bda..45f375b 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.82.2.8 2003/10/03 20:31:24 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.9 2003/10/14 18:21:59 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -738,7 +738,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) {
@@ -833,6 +833,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;