diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-14 08:32:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-14 08:32:07 (GMT) |
commit | fa083c8aaf7ff3d22de606e25adb0b598dba0dd6 (patch) | |
tree | 51134cd671ebf8759cc2b4ff148cd7d9d3797725 /generic/tkTextIndex.c | |
parent | 6eb17d212faf798cf9cd89c85467d8f8893ca614 (diff) | |
download | tk-fa083c8aaf7ff3d22de606e25adb0b598dba0dd6.zip tk-fa083c8aaf7ff3d22de606e25adb0b598dba0dd6.tar.gz tk-fa083c8aaf7ff3d22de606e25adb0b598dba0dd6.tar.bz2 |
Better approach, using "Tk" prefix for UTF-32 versions of API
Diffstat (limited to 'generic/tkTextIndex.c')
-rw-r--r-- | generic/tkTextIndex.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 31a95a7..c62a198 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -494,7 +494,7 @@ TkTextMakeCharIndex( TkTextSegment *segPtr; char *p, *start, *end; int index, offset; - Tcl_UniChar ch = 0; + int ch = 0; indexPtr->tree = tree; if (lineIndex < 0) { @@ -541,7 +541,7 @@ TkTextMakeCharIndex( return indexPtr; } charIndex--; - offset = Tcl_UtfToUniChar(p, &ch); + offset = TkUtfToUniChar(p, &ch); index += offset; } } else { @@ -1129,7 +1129,7 @@ TkTextPrintIndex( break; } if (segPtr->typePtr == &tkTextCharType) { - charIndex += Tcl_NumUtfChars(segPtr->body.chars, segPtr->size); + charIndex += TkNumUtfChars(segPtr->body.chars, segPtr->size); } else { charIndex += segPtr->size; } @@ -1137,7 +1137,7 @@ TkTextPrintIndex( } if (segPtr->typePtr == &tkTextCharType) { - charIndex += Tcl_NumUtfChars(segPtr->body.chars, numBytes); + charIndex += TkNumUtfChars(segPtr->body.chars, numBytes); } else { charIndex += numBytes; } @@ -1948,7 +1948,7 @@ TkTextIndexCount( } count += byteLen - i; if (i) { - count += Tcl_NumUtfChars(segPtr->body.chars + byteOffset + count += TkNumUtfChars(segPtr->body.chars + byteOffset + (byteLen - i), i); } } else { @@ -2210,9 +2210,6 @@ TkTextIndexBackChars( if (p == start) { break; } - if ((sizeof(Tcl_UniChar) == 2) && (unsigned)(UCHAR(*p) - 0xF0) <= 5) { - charCount--; /* Characters > U+FFFF count as 2 here */ - } if (charCount != 0) { charCount--; } |