summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 9f1f6ac..8067165 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.55 2004/11/15 13:09:07 vincentdarley Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.56 2005/02/14 23:00:29 vincentdarley Exp $
*/
#include "default.h"
@@ -905,9 +905,25 @@ TextWidgetObjCmd(clientData, interp, objc, objv)
* Caution: we must NEVER call TkTextUpdateOneLine
* with the last artificial line in the widget.
*/
- while (fromPtr != indexToPtr->linePtr) {
- value += TkTextUpdateOneLine(textPtr, fromPtr, 0, NULL);
- fromPtr = TkBTreeNextLine(textPtr, fromPtr);
+ index = *indexFromPtr;
+ while (index.linePtr != indexToPtr->linePtr) {
+ value += TkTextUpdateOneLine(textPtr, fromPtr,
+ 0, &index, 0);
+ /*
+ * We might have skipped past indexToPtr, if we
+ * have multiple logical lines in a single
+ * display line. Therefore we iterate through
+ * each intermediate logical line, just to
+ * check. Another approach would be just to use
+ * TkTextIndexCmp on every while() iteration,
+ * but that would be less efficient.
+ */
+ while (fromPtr != index.linePtr) {
+ fromPtr = TkBTreeNextLine(textPtr, fromPtr);
+ if (fromPtr == indexToPtr->linePtr) {
+ break;
+ }
+ }
}
/*
* Now we need to adjust the count to add on the