summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley@noemail.net>2005-02-14 23:00:29 (GMT)
committervincentdarley <vincentdarley@noemail.net>2005-02-14 23:00:29 (GMT)
commit22771d1c35f78582424342d621944073011a4e3d (patch)
tree270430be093e44a3695b7cae46647d503a619044 /generic/tkText.c
parent58e91bce7aa7f192f5b1a1e2d352cb91ab467af5 (diff)
downloadtk-22771d1c35f78582424342d621944073011a4e3d.zip
tk-22771d1c35f78582424342d621944073011a4e3d.tar.gz
tk-22771d1c35f78582424342d621944073011a4e3d.tar.bz2
fix to newline eliding in text widget
FossilOrigin-Name: 46ac803ae4b55ceb29a03cd1aa950ad4d8792a0f
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