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)
commitcb21b14adfd9b6e4f015d1d0acf252db71daea6a (patch)
treed72800bda1f80884a0368bed786b3e88820147df /generic/tkTextIndex.c
parent1b67bc3f8c30be0bf1d37e5c56f7effc8483e86b (diff)
downloadtk-cb21b14adfd9b6e4f015d1d0acf252db71daea6a.zip
tk-cb21b14adfd9b6e4f015d1d0acf252db71daea6a.tar.gz
tk-cb21b14adfd9b6e4f015d1d0acf252db71daea6a.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);