summaryrefslogtreecommitdiffstats
path: root/generic/tkUtil.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-20 10:10:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-20 10:10:40 (GMT)
commit75d83ece93c7c0f3a2a3c8e3a925b35353ccddeb (patch)
tree3837fda35cda470c9a59d59f26068c9fa9394441 /generic/tkUtil.c
parent5e2cf435c8008214b25114de4509a7facd345dbd (diff)
downloadtk-75d83ece93c7c0f3a2a3c8e3a925b35353ccddeb.zip
tk-75d83ece93c7c0f3a2a3c8e3a925b35353ccddeb.tar.gz
tk-75d83ece93c7c0f3a2a3c8e3a925b35353ccddeb.tar.bz2
Fix TkUtfAtIndex(), still was not 100% correct.
Simplify TKNSString::DString, since Tcl_UniCharToUtf() is already capable of surrogate handling with a proper Tcl version.
Diffstat (limited to 'generic/tkUtil.c')
-rw-r--r--generic/tkUtil.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 8d2f42e..17ba443 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1327,7 +1327,8 @@ TkUtfAtIndex(
int ch;
const char *p = Tcl_UtfAtIndex(src, index);
if ((p > src) && (UCHAR(p[-1]) >= 0xF0)) {
- return p + TkUtfToUniChar(p - 1, &ch);
+ --p;
+ return p + TkUtfToUniChar(p, &ch);
}
return p;
}