diff options
author | fvogel <fvogelnew1@free.fr> | 2014-12-30 14:59:37 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2014-12-30 14:59:37 (GMT) |
commit | 8f528741331d985f830903bcb81399e83bc9b65b (patch) | |
tree | 425a295dc7f3a75318be7306b62079f33f863994 /generic/tkTextDisp.c | |
parent | c5ab06677bacc32bf7e375716ab3f9b1df00be2e (diff) | |
download | tk-8f528741331d985f830903bcb81399e83bc9b65b.zip tk-8f528741331d985f830903bcb81399e83bc9b65b.tar.gz tk-8f528741331d985f830903bcb81399e83bc9b65b.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/tkTextDisp.c')
-rw-r--r-- | generic/tkTextDisp.c | 7 |
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 { |