summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-04-09 12:51:51 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-04-09 12:51:51 (GMT)
commit887c0cff630cefa21066a3dae3da03267fb4882d (patch)
treec81c0289058629d93a5ba6acec83816bd44a6299 /generic
parent3f7de958795b3d01851e611f2aaca65e3ab9e196 (diff)
parentb50c997b3834601c7ff959360ab907fbe0498c69 (diff)
downloadtk-887c0cff630cefa21066a3dae3da03267fb4882d.zip
tk-887c0cff630cefa21066a3dae3da03267fb4882d.tar.gz
tk-887c0cff630cefa21066a3dae3da03267fb4882d.tar.bz2
[562118ce41] Fix wordstart modifier handling of multi-byte chars
Diffstat (limited to 'generic')
-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);