summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-15 16:20:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-15 16:20:40 (GMT)
commitcbfdce772a38825e7f2296c43b6b5c4970d83098 (patch)
treeb3ff995e311e3d6e12ef6166154a449e65dc5a59
parentc163c0fb17034d377e995e82eee1f28807586eba (diff)
parent0d58cca19add2b455623c3e7399d7797ae8400e6 (diff)
downloadtcl-cbfdce772a38825e7f2296c43b6b5c4970d83098.zip
tcl-cbfdce772a38825e7f2296c43b6b5c4970d83098.tar.gz
tcl-cbfdce772a38825e7f2296c43b6b5c4970d83098.tar.bz2
Merge 8.6
-rw-r--r--generic/tclUtil.c5
-rw-r--r--tests/string.test4
2 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 1288738..eef6393 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1708,6 +1708,9 @@ TclTrimRight(
int pInc = 0, bytesLeft = numTrim;
pp = TclUtfPrev(p, bytes);
+#if TCL_UTF_MAX < 4
+ pp = TclUtfPrev(pp, bytes);
+#endif
do {
pp += pInc;
pInc = TclUtfToUCS4(pp, &ch1);
@@ -1771,7 +1774,7 @@ TclTrimLeft(
* rely on (trim[numTrim] == '\0'). */
{
const char *p = bytes;
- int ch1, ch2;
+ int ch1, ch2;
/* Empty strings -> nothing to do */
if ((numBytes == 0) || (numTrim == 0)) {
diff --git a/tests/string.test b/tests/string.test
index d7bdc10..b01d059 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -1897,13 +1897,13 @@ test string-21.15.$noComp {string wordend, unicode} -body {
test string-21.16.$noComp {string wordend, unicode} -constraints utf16 -body {
run {string wordend "\U1D7CA\U1D7CA abc" 10}
} -result 8
-test string-21.17.$noComp {string trim, unicode} knownBug {
+test string-21.17.$noComp {string trim, unicode} {
run {string trim "\uD83D\uDE02Hello world!\uD83D\uDE02" \uD83D\uDE02}
} "Hello world!"
test string-21.18.$noComp {string trimleft, unicode} {
run {string trimleft "\uD83D\uDE02Hello world!\uD83D\uDE02" \uD83D\uDE02}
} "Hello world!\uD83D\uDE02"
-test string-21.19.$noComp {string trimright, unicode} knownBug {
+test string-21.19.$noComp {string trimright, unicode} {
run {string trimright "\uD83D\uDE02Hello world!\uD83D\uDE02" \uD83D\uDE02}
} "\uD83D\uDE02Hello world!"
test string-21.20.$noComp {string trim, unicode} {