summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-13 15:01:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-13 15:01:38 (GMT)
commit9b529e05399279d3631a9740e3b61bb19a1af5d8 (patch)
tree0a91f7f4694d6ce28627cc80407449bb9fb0417f /generic
parent5ca0fff784edcbd2b7eabe15c8aa7ed414ca12f2 (diff)
downloadtcl-9b529e05399279d3631a9740e3b61bb19a1af5d8.zip
tcl-9b529e05399279d3631a9740e3b61bb19a1af5d8.tar.gz
tcl-9b529e05399279d3631a9740e3b61bb19a1af5d8.tar.bz2
Known bug test string-22.14 is not so hard to fix.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdMZ.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index d4fa4e9..6515d98 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -2396,12 +2396,22 @@ StringStartCmd(
cur = 0;
if (index > 0) {
p = Tcl_UtfAtIndex(string, index);
+
+ TclUtfToUniChar(p, &ch);
for (cur = index; cur >= 0; cur--) {
- TclUtfToUniChar(p, &ch);
+ int delta = 0;
+ const char *next;
+
if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
- p = Tcl_UtfPrev(p, string);
+
+ next = Tcl_UtfPrev(p, string);
+ do {
+ next += delta;
+ delta = TclUtfToUniChar(next, &ch);
+ } while (next + delta < p);
+ p = next;
}
if (cur != index) {
cur += 1;