summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkTextDisp.c34
2 files changed, 30 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index a42de16..072d065 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: fix for [Bug 1143776] in adjusting
+ displayed lines when running into the bottom of the window.
+
2005-03-14 Jim Ingham <jingham@apple.com>
* macosx/tkMacOSXScrlbr.c (ThumbActionProc): No need to use
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index bef5148..f85e0db 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextDisp.c,v 1.47 2005/02/14 23:00:44 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.48 2005/03/15 14:07:47 vincentdarley Exp $
*/
#include "tkPort.h"
@@ -1804,6 +1804,11 @@ UpdateDisplayInfo(textPtr)
*/
if (y < maxY) {
+ /*
+ * This counts how many vertical pixels we have left to fill
+ * by pulling in more display pixels either from the first
+ * currently displayed, or the lines above it.
+ */
int spaceLeft = maxY - y;
if (spaceLeft <= dInfoPtr->newTopPixelOffset) {
@@ -1918,16 +1923,27 @@ UpdateDisplayInfo(textPtr)
bytesToCount = INT_MAX;
}
/*
- * We've filled in the space we wanted to, and we
- * need to store any extra overlap we've just
- * created for the top line.
+ * We've either filled in the space we wanted to or we've
+ * run out of display lines at the top of the text. Note
+ * that we already set dInfoPtr->newTopPixelOffset to zero
+ * above.
*/
- if (lineNum >= 0) {
+ if (spaceLeft < 0) {
+ /*
+ * We've laid out a few too many vertical pixels at or
+ * above the first line. Therefore we only want to show
+ * part of the first displayed line, so that the last
+ * displayed line just fits in the window.
+ */
dInfoPtr->newTopPixelOffset = -spaceLeft;
- if (spaceLeft > 0 ||
- dInfoPtr->newTopPixelOffset >= dInfoPtr->dLinePtr->height) {
- /* Bad situation */
- Tcl_Panic("Pixel height problem while laying out text widget");
+ if (dInfoPtr->newTopPixelOffset >= dInfoPtr->dLinePtr->height) {
+ /*
+ * Somehow the entire first line we laid out is
+ * shorter than the new offset. This should not
+ * occur and would indicate a bad problem in the
+ * logic above.
+ */
+ Tcl_Panic("Error in pixel height consistency while filling in spacesLeft");
}
}
}