summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorfvogelnew1@free.fr <fvogel>2014-12-30 14:59:37 (GMT)
committerfvogelnew1@free.fr <fvogel>2014-12-30 14:59:37 (GMT)
commit9a65f020d7ea80229d35a89f076529fdb9c895ae (patch)
tree62fd466cee2ea7521667cf312b13daa657284c22 /generic
parent42a07e838bd52d2daa3e69876f001ae6310343aa (diff)
downloadtk-9a65f020d7ea80229d35a89f076529fdb9c895ae.zip
tk-9a65f020d7ea80229d35a89f076529fdb9c895ae.tar.gz
tk-9a65f020d7ea80229d35a89f076529fdb9c895ae.tar.bz2
Polishing FindDLine - Avoid use of TkTextFindDisplayLineEnd when not really necessary (performance reasons, and avoids LayoutDLine/FreeDLine which maps/unmaps embedded windows unnecessarily)
Diffstat (limited to 'generic')
-rw-r--r--generic/tkTextDisp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index a63c9bc..6b23002 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -6592,7 +6592,6 @@ FindDLine(
CONST TkTextIndex *indexPtr)/* Index of desired character. */
{
DLine *dlPtrPrev;
- TkTextIndex indexPtr2;
if (dlPtr == NULL) {
return NULL;
@@ -6617,14 +6616,16 @@ FindDLine(
dlPtrPrev = dlPtr;
dlPtr = dlPtr->nextPtr;
if (dlPtr == NULL) {
+ TkTextIndex indexPtr2;
/*
* We're past the last display line, either because the desired
* index lies past the visible text, or because the desired index
* is on the last display line showing the last logical line.
*/
indexPtr2 = dlPtrPrev->index;
- TkTextFindDisplayLineEnd(textPtr, &indexPtr2, 1, NULL);
- if (TkTextIndexCmp(&indexPtr2,indexPtr) >= 0) {
+ TkTextIndexForwBytes(textPtr, &indexPtr2, dlPtrPrev->byteCount,
+ &indexPtr2);
+ if (TkTextIndexCmp(&indexPtr2,indexPtr) > 0) {
dlPtr = dlPtrPrev;
break;
} else {