diff options
author | fvogel <fvogelnew1@free.fr> | 2015-02-09 22:52:58 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2015-02-09 22:52:58 (GMT) |
commit | 5fb0e4f1ac206e6981eafc494432196cd34e138f (patch) | |
tree | 07faf0191cfa307638139254952210ee698ae085 /generic | |
parent | 100c8158bd4887b6481076f77ddeb6dbf1167d9f (diff) | |
parent | e10d9b811fe94f005b7639f5ec90eb9246c07165 (diff) | |
download | tk-5fb0e4f1ac206e6981eafc494432196cd34e138f.zip tk-5fb0e4f1ac206e6981eafc494432196cd34e138f.tar.gz tk-5fb0e4f1ac206e6981eafc494432196cd34e138f.tar.bz2 |
Fixed crash in 'text see' - Bug [e0f1c380bd]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTextDisp.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 3ab9fde..9c0dcf9 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -5557,31 +5557,34 @@ 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) { - return TCL_OK; - } - if (delta > oneThird) { - dInfoPtr->newXPixelOffset = x - lineWidth/2; + 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; + } } else { - dInfoPtr->newXPixelOffset += delta; + delta -= lineWidth - width; + if (delta <= 0) { + return TCL_OK; + } + if (delta > oneThird) { + dInfoPtr->newXPixelOffset = x - lineWidth/2; + } else { + dInfoPtr->newXPixelOffset += delta; + } } } dInfoPtr->flags |= DINFO_OUT_OF_DATE; |