diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-15 16:20:40 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-15 16:20:40 (GMT) |
| commit | cb794e731c3d27894fe2df57ef87416755b2d01d (patch) | |
| tree | b3ff995e311e3d6e12ef6166154a449e65dc5a59 | |
| parent | b4660a7ff9a3dac758b033af3fd7618db6a68b9d (diff) | |
| parent | c6e348a28b0d74bc880f56b2f2db6f8c97f1b6ca (diff) | |
| download | tcl-cb794e731c3d27894fe2df57ef87416755b2d01d.zip tcl-cb794e731c3d27894fe2df57ef87416755b2d01d.tar.gz tcl-cb794e731c3d27894fe2df57ef87416755b2d01d.tar.bz2 | |
Merge 8.6
| -rw-r--r-- | generic/tclUtil.c | 5 | ||||
| -rw-r--r-- | tests/string.test | 4 |
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} { |
