diff options
author | fvogel <fvogelnew1@free.fr> | 2015-04-07 20:12:59 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2015-04-07 20:12:59 (GMT) |
commit | 4610c49d14dca5fccf40ec756596ce6258821130 (patch) | |
tree | 62915ba2918eeee02ceeb0aacdc0b8f4aa43b0ed /generic | |
parent | e775b13da67a5d546caac2cf1a2c76d63d80d254 (diff) | |
download | tk-4610c49d14dca5fccf40ec756596ce6258821130.zip tk-4610c49d14dca5fccf40ec756596ce6258821130.tar.gz tk-4610c49d14dca5fccf40ec756596ce6258821130.tar.bz2 |
Fix wordstart modifier for UTF-8 text - Bug [562118ce41]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTextIndex.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 13f3957..7cb71bb 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -2369,11 +2369,20 @@ StartEnd( } firstChar = 0; } - offset -= chSize; - indexPtr->byteIndex -= chSize; + if (offset == 0) { + if (modifier == TKINDEX_DISPLAY) { + TkTextIndexBackChars(textPtr, indexPtr, 1, indexPtr, + COUNT_DISPLAY_INDICES); + } else { + TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, + COUNT_INDICES); + } + } else { + indexPtr->byteIndex -= chSize; + } + offset -= chSize; if (offset < 0) { - if (indexPtr->byteIndex < 0) { - indexPtr->byteIndex = 0; + if (indexPtr->byteIndex == 0) { goto done; } segPtr = TkTextIndexToSeg(indexPtr, &offset); |