Juergen Vigna <[EMAIL PROTECTED]> writes:

| On 03-Jul-2001 Lars Gullik Bjønnes wrote:
| 
| > but... I don't really know what the trick/hack for UNDO is supposed to
| > accomplish and why... seem to be a bandaid of somekind.
| 
| Well you won't believe it but that comment is right! So if you remove
| that row be aware that undo will not work anymore!

So you would prefere this patch then:

Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.135
diff -u -p -r1.135 text2.C
--- text2.C     2001/07/03 13:04:31     1.135
+++ text2.C     2001/07/03 14:58:15
@@ -758,6 +758,8 @@ void LyXText::redoHeightOfParagraph(Buff
        int y = cur.y() - tmprow->baseline();
 
        setHeightOfRow(bview, tmprow);
+       
+#if 0
        Paragraph * first_phys_par = tmprow->par();
 
        // find the first row of the paragraph
@@ -773,6 +775,13 @@ void LyXText::redoHeightOfParagraph(Buff
                y -= tmprow->height();
                setHeightOfRow(bview, tmprow);
        }
+#else
+       while (tmprow->previous() && tmprow->previous()->par() == tmprow->par()) {
+               tmprow = tmprow->previous();
+               y -= tmprow->height();
+               setHeightOfRow(bview, tmprow);
+       }
+#endif
        
        // we can set the refreshing parameters now
        status = LyXText::NEED_MORE_REFRESH;
@@ -788,6 +797,8 @@ void LyXText::redoDrawingOfParagraph(Buf
    
        int y = cur.y() - tmprow->baseline();
        setHeightOfRow(bview, tmprow);
+
+#if 0
        Paragraph * first_phys_par = tmprow->par();
 
        // find the first row of the paragraph
@@ -800,7 +811,12 @@ void LyXText::redoDrawingOfParagraph(Buf
                tmprow = tmprow->previous();
                y -= tmprow->height();
        }
-   
+#else
+       while (tmprow->previous() && tmprow->previous()->par() == tmprow->par())  {
+               tmprow = tmprow->previous();
+               y -= tmprow->height();
+       }
+#endif
        // we can set the refreshing parameters now
        if (status == LyXText::UNCHANGED || y < refresh_y) {
                refresh_y = y;
@@ -818,13 +834,15 @@ void LyXText::redoParagraphs(BufferView 
                             Paragraph const * endpar) const
 {
        Row * tmprow2;
-       Paragraph * tmppar = 0, * first_phys_par = 0;
+       Paragraph * tmppar = 0;
+       Paragraph * first_phys_par = 0;
    
        Row * tmprow = cur.row();
    
        int y = cur.y() - tmprow->baseline();
-   
-       if (!tmprow->previous()){
+
+#if 0
+       if (!tmprow->previous()) {
                first_phys_par = firstParagraph();   // a trick/hack for UNDO
        } else {
                first_phys_par = tmprow->par();
@@ -841,7 +859,22 @@ void LyXText::redoParagraphs(BufferView 
                        y -= tmprow->height();
                }
        }
-   
+#else
+       if (!tmprow->previous()) {
+               // a trick/hack for UNDO
+               // Can somebody please tell me _why_ this solves
+               // anything. (Lgb)
+               first_phys_par = firstParagraph();
+       } else {
+               first_phys_par = tmprow->par();
+               while (tmprow->previous()
+                      && tmprow->previous()->par() == first_phys_par) {
+                       tmprow = tmprow->previous();
+                       y -= tmprow->height();
+               }
+       }
+#endif
+       
        // we can set the refreshing parameters now
        status = LyXText::NEED_MORE_REFRESH;
        refresh_y = y;

-- 
        Lgb

Reply via email to