diff options
author | fvogelnew1@free.fr <fvogel> | 2014-11-30 21:21:08 (GMT) |
---|---|---|
committer | fvogelnew1@free.fr <fvogel> | 2014-11-30 21:21:08 (GMT) |
commit | 71476a92e44c431741a6631781177042de9647ca (patch) | |
tree | 1e637d3b6176cff0aeec015f7de54fb66b6029da /generic/tkTextDisp.c | |
parent | 6aa9287c307b91afba9cbce1e1b8ce8fe44a6e0f (diff) | |
download | tk-71476a92e44c431741a6631781177042de9647ca.zip tk-71476a92e44c431741a6631781177042de9647ca.tar.gz tk-71476a92e44c431741a6631781177042de9647ca.tar.bz2 |
Fixed bbox caller of FindDLine, see case 'B' in bug [7703f947aa]
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r-- | generic/tkTextDisp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 2b88ad6..c1b477c 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -6826,15 +6826,29 @@ TkTextIndexBbox( */ dlPtr = FindDLine(dInfoPtr->dLinePtr, indexPtr); + + /* + * Two cases shall be trapped here because the logic later really + * needs dlPtr to be the display line containing indexPtr: + * 1. if no display line contains the desired index (NULL dlPtr) + * 2. if indexPtr is before the first display line, in which case + * dlPtr currently points to the first display line + */ + if ((dlPtr == NULL) || (TkTextIndexCmp(&dlPtr->index, indexPtr) > 0)) { return -1; } /* - * Find the chunk within the line that contains the desired index. + * Find the chunk within the display line that contains the desired + * index. The chunks making the display line are skipped up to but not + * including the one crossing indexPtr. Skipping is done based on + * a byteIndex offset possibly spanning several logical lines in case + * they are elided. */ - byteIndex = indexPtr->byteIndex - dlPtr->index.byteIndex; + byteIndex = TkTextIndexCount(textPtr, &dlPtr->index, indexPtr, + COUNT_INDICES); for (chunkPtr = dlPtr->chunkPtr; ; chunkPtr = chunkPtr->nextPtr) { if (chunkPtr == NULL) { return -1; |