diff options
author | dgp <dgp@users.sourceforge.net> | 2015-04-09 12:50:22 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2015-04-09 12:50:22 (GMT) |
commit | b50c997b3834601c7ff959360ab907fbe0498c69 (patch) | |
tree | 74c6a8c804211ec12f1d5104a5e2d19f7515ab64 /generic | |
parent | f834b107eaf34a513bc41be49e0ad054af11cc6a (diff) | |
parent | 092fc0d2df191c5676cd4c39da254d9a35e8da1e (diff) | |
download | tk-b50c997b3834601c7ff959360ab907fbe0498c69.zip tk-b50c997b3834601c7ff959360ab907fbe0498c69.tar.gz tk-b50c997b3834601c7ff959360ab907fbe0498c69.tar.bz2 |
[562118ce41] Fix wordstart modifier handling of multi-byte chars
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTextIndex.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index b2919d5..6a60faf 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -2218,7 +2218,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; @@ -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); |