summaryrefslogtreecommitdiffstats
path: root/generic/tkTextIndex.c
diff options
context:
space:
mode:
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);