summaryrefslogtreecommitdiffstats
path: root/generic/tkTextIndex.c
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2015-04-09 12:51:51 (GMT)
committerdgp <dgp@noemail.net>2015-04-09 12:51:51 (GMT)
commit366f00d4a312d2852c84d0b767145669f3e8e9e7 (patch)
treec81c0289058629d93a5ba6acec83816bd44a6299 /generic/tkTextIndex.c
parent428c1cd6d27bf09feb46c0cdb89414ac53830c06 (diff)
parenta246980eebbfa9d7027e481f90beb25ec90fc0c8 (diff)
downloadtk-366f00d4a312d2852c84d0b767145669f3e8e9e7.zip
tk-366f00d4a312d2852c84d0b767145669f3e8e9e7.tar.gz
tk-366f00d4a312d2852c84d0b767145669f3e8e9e7.tar.bz2
[562118ce41] Fix wordstart modifier handling of multi-byte chars
FossilOrigin-Name: 8becf1a0224f88d0668a2af29e12e73a3cd037ac
Diffstat (limited to 'generic/tkTextIndex.c')
-rw-r--r--generic/tkTextIndex.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 418b934..564b4c3 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -2205,7 +2205,7 @@ StartEnd(
TkText *textPtr, /* Information about text widget. */
const char *string, /* String to parse for additional info about
* modifier (count and units). Points to first
- * character of modifer word. */
+ * character of modifier word. */
TkTextIndex *indexPtr) /* Index to modify based on string. */
{
const char *p;
@@ -2356,11 +2356,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);