diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-01-18 16:14:33 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-01-18 16:14:33 (GMT) |
commit | fe2b8e7edafb72ea246c46d10a3f154ae89b69ee (patch) | |
tree | 23ec066945152bcecd5be8d9a2394353d174f697 /generic/tclCmdMZ.c | |
parent | 5a88b1460b0b97b1bc3f5688b5569b0d9ab64b73 (diff) | |
parent | f97560a94963b378ccc5b75e5dbc2949eca30b9f (diff) | |
download | tcl-fe2b8e7edafb72ea246c46d10a3f154ae89b69ee.zip tcl-fe2b8e7edafb72ea246c46d10a3f154ae89b69ee.tar.gz tcl-fe2b8e7edafb72ea246c46d10a3f154ae89b69ee.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index a3b6eca..83a1dbc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -395,9 +395,13 @@ Tcl_RegexpObjCmd( newPtr = Tcl_NewListObj(2, objs); } else { if (i <= (int)info.nsubs) { - newPtr = Tcl_GetRange(objPtr, - offset + info.matches[i].start, - offset + info.matches[i].end - 1); + if (info.matches[i].end + 1 <= 1) { + TclNewObj(newPtr); + } else { + newPtr = Tcl_GetRange(objPtr, + offset + info.matches[i].start, + offset + info.matches[i].end - 1); + } } else { newPtr = Tcl_NewObj(); } @@ -2307,10 +2311,9 @@ StringRangeCmd( return TCL_ERROR; } - if (first == TCL_INDEX_NONE) { - first = TCL_INDEX_START; + if (last != TCL_INDEX_NONE) { + Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last)); } - Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last)); return TCL_OK; } |