summaryrefslogtreecommitdiffstats
path: root/generic/tkTextIndex.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2004-06-04 10:51:17 (GMT)
committervincentdarley <vincentdarley>2004-06-04 10:51:17 (GMT)
commit0599d09e8d0ef7c3d1d1afbd61e61e2a4c14b099 (patch)
treed72800bda1f80884a0368bed786b3e88820147df /generic/tkTextIndex.c
parentdf2af8293fc2b2a31a501cf87e04b8b34729dc9f (diff)
downloadtk-0599d09e8d0ef7c3d1d1afbd61e61e2a4c14b099.zip
tk-0599d09e8d0ef7c3d1d1afbd61e61e2a4c14b099.tar.gz
tk-0599d09e8d0ef7c3d1d1afbd61e61e2a4c14b099.tar.bz2
text widget fixes
Diffstat (limited to 'generic/tkTextIndex.c')
-rw-r--r--generic/tkTextIndex.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 41702f1..44deddd 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextIndex.c,v 1.17 2004/02/28 16:04:43 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextIndex.c,v 1.18 2004/06/04 10:51:18 vincentdarley Exp $
*/
#include "default.h"
@@ -286,6 +286,10 @@ TkTextNewIndexObj(textPtr, indexPtr)
*
* Given a pixel index and a byte index, look things up in the B-tree
* and fill in a TkTextIndex structure.
+ *
+ * The valid input range for pixelIndex is from 0 to the number
+ * of pixels in the widget-1. Anything outside that range will
+ * be rounded to the closest acceptable value.
*
* Results:
*
@@ -321,6 +325,10 @@ TkTextMakePixelIndex(textPtr, pixelIndex, indexPtr)
}
indexPtr->linePtr = TkBTreeFindPixelLine(textPtr->tree, pixelIndex,
&pixelOffset);
+ /*
+ * 'pixedlIndex' was too large, so we try again, just to find
+ * the last pixel in the window
+ */
if (indexPtr->linePtr == NULL) {
indexPtr->linePtr = TkBTreeFindPixelLine(textPtr->tree,
TkBTreeNumPixels(textPtr->tree)-1, &pixelOffset);