]> git.lyx.org Git - lyx.git/blobdiff - src/screen.C
More fixes to the autocollapsing of paragraphs.
[lyx.git] / src / screen.C
index c9590cf578aed6885ba16dd2624d9d7f9c37019b..561ac127b6d5f271028e3deb0794ce5fbee833f8 100644 (file)
@@ -129,7 +129,7 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
                text->getVisibleRow(bv, y + y_offset,
                                    x_offset, row, y + text->first);
                internal = internal && (st != LyXText::CHANGED_IN_DRAW);
-               while(internal && text->status() == LyXText::CHANGED_IN_DRAW) {
+               while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
                        if (text->fullRebreak(bv)) {
                                st = LyXText::NEED_MORE_REFRESH;
                                text->setCursor(bv, text->cursor.par(), text->cursor.pos());
@@ -393,21 +393,25 @@ unsigned int LyXScreen::topCursorVisible(LyXText const * text)
            + text->cursor.row()->height()
            - text->first >= owner.height()) {
                if (text->cursor.row()->height() < owner.height()
-                   && text->cursor.row()->height() > owner.height() / 4)
+                   && text->cursor.row()->height() > owner.height() / 4) {
                        newtop = text->cursor.y()
                                + text->cursor.row()->height()
                                - text->cursor.row()->baseline() - owner.height();
-               else
+               } else {
+                       // scroll down
                        newtop = text->cursor.y()
-                               - 3 * owner.height() / 4;   /* the scroll region must be so big!! */
+                               - owner.height() / 2;   /* the scroll region must be so big!! */
+               }
+               
        } else if (static_cast<int>((text->cursor.y()) - text->cursor.row()->baseline()) <
                   text->first && text->first > 0)
        {
                if (text->cursor.row()->height() < owner.height()
-                   && text->cursor.row()->height() > owner.height() / 4)
+                   && text->cursor.row()->height() > owner.height() / 4) {
                        newtop = text->cursor.y() - text->cursor.row()->baseline();
-               else {
-                       newtop = text->cursor.y() - owner.height() / 4;
+               } else {
+                       // scroll up
+                       newtop = text->cursor.y() - owner.height() / 2;
                        newtop = min(newtop, int(text->first));
                }
        }