diff options
author | fvogel <fvogelnew1@free.fr> | 2015-02-09 22:26:26 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2015-02-09 22:26:26 (GMT) |
commit | e10d9b811fe94f005b7639f5ec90eb9246c07165 (patch) | |
tree | ac4c9984dc526cf36fc8522478cc9e4b4bc0689f /generic/tkTextDisp.c | |
parent | 518e00a1dc2614aea4205513a4a3d32eb308ad72 (diff) | |
download | tk-e10d9b811fe94f005b7639f5ec90eb9246c07165.zip tk-e10d9b811fe94f005b7639f5ec90eb9246c07165.tar.gz tk-e10d9b811fe94f005b7639f5ec90eb9246c07165.tar.bz2 |
Fixed crash in 'text see' - Bug [e0f1c380bd]
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r-- | generic/tkTextDisp.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 49a35f5..f718e2a 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -5546,32 +5546,35 @@ TkTextSeeCmd( /* * Call a chunk-specific function to find the horizontal range of the - * character within the chunk. + * character within the chunk. chunkPtr is NULL if trying to see in elided + * region. */ - (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteCount, - dlPtr->y + dlPtr->spaceAbove, - dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, - dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width, - &height); - delta = x - dInfoPtr->curXPixelOffset; - oneThird = lineWidth/3; - if (delta < 0) { - if (delta < -oneThird) { - dInfoPtr->newXPixelOffset = (x - lineWidth/2); - } else { - dInfoPtr->newXPixelOffset -= ((-delta) ); - } - } else { - delta -= (lineWidth - width); - if (delta > 0) { - if (delta > oneThird) { + if (chunkPtr != NULL) { + (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteCount, + dlPtr->y + dlPtr->spaceAbove, + dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, + dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width, + &height); + delta = x - dInfoPtr->curXPixelOffset; + oneThird = lineWidth/3; + if (delta < 0) { + if (delta < -oneThird) { dInfoPtr->newXPixelOffset = (x - lineWidth/2); } else { - dInfoPtr->newXPixelOffset += (delta ); + dInfoPtr->newXPixelOffset -= ((-delta) ); } } else { - return TCL_OK; + delta -= (lineWidth - width); + if (delta > 0) { + if (delta > oneThird) { + dInfoPtr->newXPixelOffset = (x - lineWidth/2); + } else { + dInfoPtr->newXPixelOffset += (delta ); + } + } else { + return TCL_OK; + } } } dInfoPtr->flags |= DINFO_OUT_OF_DATE; |