Lars Gullik BjÃnnes wrote:

> | This should fix it. Could you confirm?
> 
> I can try to.
> 
> It is not something that happened every time.
> But I'll test a bit with this patch.

I'll commit this in a while if there are no objections.

This is the above fix (but reintroducing the optimization by using
nullpainter) + two small fixes to tabular scrolling: one is a bug in a call
to scroll, because int and float have different meanings thereÂ, the other
is a small visual correction.

 not very nice choice IMO ;-)

Alfredo
Index: insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.447
diff -u -p -u -r1.447 insettabular.C
--- insettabular.C	3 Dec 2004 13:57:50 -0000	1.447
+++ insettabular.C	4 Dec 2004 19:14:39 -0000
@@ -263,14 +263,14 @@ void InsetTabular::metrics(MetricsInfo &
 
 void InsetTabular::draw(PainterInfo & pi, int x, int y) const
 {
+
 	//lyxerr << "InsetTabular::draw: " << x << " " << y << endl;
 	BufferView * bv = pi.base.bv;
+	resetPos(bv->cursor());
 
 	static NullPainter nop;
 	static PainterInfo nullpi(bv, nop);
 
-	resetPos(bv->cursor());
-
 	setPosCache(pi, x, y);
 
 	x += scroll();
@@ -283,11 +283,6 @@ void InsetTabular::draw(PainterInfo & pi
 		int const a = tabular.getAscentOfRow(i);
 		int const d = tabular.getDescentOfRow(i);
 		idx = tabular.getCellNumber(i, 0);
-		if (y + d <= 0 && y - a < pi.pain.paperHeight()) {
-			y += d	+ tabular.getAscentOfRow(i + 1)
-				+ tabular.getAdditionalHeight(i + 1);
-			continue;
-		}
 		for (col_type j = 0; j < tabular.columns(); ++j) {
 			if (tabular.isPartOfMultiColumn(i, j))
 				continue;
@@ -297,6 +292,7 @@ void InsetTabular::draw(PainterInfo & pi
 			int const cx = nx + tabular.getBeginningOfTextInCell(idx);
 			if (nx + tabular.getWidthOfColumn(idx) < 0
 			    || nx > bv->workWidth()
+			    || y + d < 0
 			    || y - a > bv->workHeight()) {
 				cell(idx)->draw(nullpi, cx, y);
 				drawCellLines(nop, nx, y, i, idx);
@@ -1107,7 +1103,7 @@ void InsetTabular::resetPos(LCursor & cu
 //	}
 
 	if (&cur.inset() != this) {
-		scroll(bv, 0);
+		scroll(bv, 0.0F);
 	} else {
 		int const X1 = 0;
 		int const X2 = bv.workWidth();
@@ -1116,9 +1112,9 @@ void InsetTabular::resetPos(LCursor & cu
 		int const x1 = getCellXPos(cur.idx()) + offset + scroll();
 		int const x2 = x1 + col_width;
 
-		if (x1 < X1 + 20)
+		if (x1 < X1)
 			scroll(bv, X1 + 20 - x1);
-		else if (x2 > X2 - 20)
+		else if (x2 > X2)
 			scroll(bv, X2 - 20 - x2);
 	}
 

Reply via email to