summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2005-02-14 23:00:29 (GMT)
committervincentdarley <vincentdarley>2005-02-14 23:00:29 (GMT)
commit6e1a009795f451583308dda6b41c6249b637933c (patch)
tree270430be093e44a3695b7cae46647d503a619044 /generic/tkText.c
parent496ad1df6abb7e07d1c616e01bb3715ad49ab695 (diff)
downloadtk-6e1a009795f451583308dda6b41c6249b637933c.zip
tk-6e1a009795f451583308dda6b41c6249b637933c.tar.gz
tk-6e1a009795f451583308dda6b41c6249b637933c.tar.bz2
fix to newline eliding in text widget
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