summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvText.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-24 21:29:59 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-24 21:29:59 (GMT)
commita8636d143def6ec81330e49af713edbb2e08862a (patch)
treeecbaea802a0bc17da9aaadc8f12c97d15e9c768d /generic/tkCanvText.c
parent334a6b720c513b352e0b4d13dc50b498a78c2ee4 (diff)
downloadtk-a8636d143def6ec81330e49af713edbb2e08862a.zip
tk-a8636d143def6ec81330e49af713edbb2e08862a.tar.gz
tk-a8636d143def6ec81330e49af713edbb2e08862a.tar.bz2
More progress
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r--generic/tkCanvText.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index d873d12..3c8f364 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -32,7 +32,7 @@ typedef struct TextItem {
*/
double x, y; /* Positioning point for text. */
- int insertPos; /* Character index of character just before
+ TkSizeT insertPos; /* Character index of character just before
* which the insertion cursor is displayed. */
/*
@@ -62,8 +62,8 @@ typedef struct TextItem {
* configuration settings above.
*/
- int numChars; /* Length of text in characters. */
- int numBytes; /* Length of text in bytes. */
+ TkSizeT numChars; /* Length of text in characters. */
+ TkSizeT numBytes; /* Length of text in bytes. */
Tk_TextLayout textLayout; /* Cached text layout information. */
int actualWidth; /* Width of text as computed. Used to make
* selections of wrapped text display
@@ -510,19 +510,19 @@ ConfigureText(
textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes);
if (textInfoPtr->selItemPtr == itemPtr) {
- if (textInfoPtr->selectFirst >= textPtr->numChars) {
+ if (textInfoPtr->selectFirst >= (int)textPtr->numChars) {
textInfoPtr->selItemPtr = NULL;
} else {
- if (textInfoPtr->selectLast >= textPtr->numChars) {
+ if (textInfoPtr->selectLast >= (int)textPtr->numChars) {
textInfoPtr->selectLast = textPtr->numChars - 1;
}
if ((textInfoPtr->anchorItemPtr == itemPtr)
- && (textInfoPtr->selectAnchor >= textPtr->numChars)) {
+ && (textInfoPtr->selectAnchor >= (int)textPtr->numChars)) {
textInfoPtr->selectAnchor = textPtr->numChars - 1;
}
}
}
- if (textPtr->insertPos >= textPtr->numChars) {
+ if (textPtr->insertPos + 1 >= textPtr->numChars + 1) {
textPtr->insertPos = textPtr->numChars;
}
@@ -846,7 +846,7 @@ DisplayCanvText(
if (textInfoPtr->selItemPtr == itemPtr) {
selFirstChar = textInfoPtr->selectFirst;
selLastChar = textInfoPtr->selectLast;
- if (selLastChar > textPtr->numChars) {
+ if (selLastChar > (int)textPtr->numChars) {
selLastChar = textPtr->numChars - 1;
}
if ((selFirstChar >= 0) && (selFirstChar <= selLastChar)) {
@@ -969,7 +969,7 @@ DisplayCanvText(
TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
selFirstChar, selLastChar + 1);
- if (selLastChar + 1 < textPtr->numChars) {
+ if (selLastChar + 1 < (int)textPtr->numChars) {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
selLastChar + 1, textPtr->numChars);
@@ -1027,7 +1027,7 @@ TextInsert(
if (index < 0) {
index = 0;
}
- if (index > textPtr->numChars) {
+ if (index > (int)textPtr->numChars) {
index = textPtr->numChars;
}
byteIndex = Tcl_UtfAtIndex(text, index) - text;
@@ -1064,7 +1064,7 @@ TextInsert(
textInfoPtr->selectAnchor += charsAdded;
}
}
- if (textPtr->insertPos >= index) {
+ if (textPtr->insertPos + 1 >= (TkSizeT)index + 1) {
textPtr->insertPos += charsAdded;
}
ComputeTextBbox(canvas, textPtr);
@@ -1105,7 +1105,7 @@ TextDeleteChars(
if (first < 0) {
first = 0;
}
- if (last >= textPtr->numChars) {
+ if (last >= (int)textPtr->numChars) {
last = textPtr->numChars - 1;
}
if (first > last) {
@@ -1155,9 +1155,9 @@ TextDeleteChars(
}
}
}
- if (textPtr->insertPos > first) {
+ if ((int)textPtr->insertPos > first) {
textPtr->insertPos -= charsRemoved;
- if (textPtr->insertPos < first) {
+ if ((int)textPtr->insertPos < first) {
textPtr->insertPos = first;
}
}
@@ -1393,7 +1393,7 @@ GetTextIndex(
if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
if (idx == TCL_INDEX_NONE) {
idx = 0;
- } else if (idx > (TkSizeT)textPtr->numChars) {
+ } else if (idx > textPtr->numChars) {
idx = textPtr->numChars;
}
*indexPtr = (int)idx;
@@ -1489,7 +1489,7 @@ SetTextCursor(
if (index < 0) {
textPtr->insertPos = 0;
- } else if (index > textPtr->numChars) {
+ } else if (index > (int)textPtr->numChars) {
textPtr->insertPos = textPtr->numChars;
} else {
textPtr->insertPos = index;