]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/screen.C
Joao latest bits
[lyx.git] / src / frontends / screen.C
index ec07bc3b72bd0e30ce962048e5f0fdd3178f2959..10dab24a2c3b1c45b55384088e6f9b1482e00a70 100644 (file)
@@ -29,6 +29,7 @@
 #include "lyxrow.h"
 #include "lyxtext.h"
 #include "metricsinfo.h"
+#include "paragraph.h"
 #include "rowpainter.h"
 #include "version.h"
 
@@ -45,6 +46,7 @@
 
 using lyx::support::LibFileSearch;
 
+using std::endl;
 using std::min;
 using std::max;
 using std::string;
@@ -256,22 +258,22 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text)
        int newtop = top_y;
        unsigned int const vheight = workarea().workHeight();
 
-       RowList::iterator row = text->cursorRow();
+       Row & row = *text->cursorPar()->getRow(cursor.pos());
 
-       if (int(cursor.y() - row->baseline() + row->height() - top_y) >= vheight) {
-               if (row->height() < vheight
-                   && row->height() > vheight / 4) {
+       if (int(cursor.y() - row.baseline() + row.height() - top_y) >= vheight) {
+               if (row.height() < vheight
+                   && row.height() > vheight / 4) {
                        newtop = cursor.y()
-                               + row->height()
-                               - row->baseline() - vheight;
+                               + row.height()
+                               - row.baseline() - vheight;
                } else {
                        // scroll down, the scroll region must be so big!!
                        newtop = cursor.y() - vheight / 2;
                }
 
-       } else if (int(cursor.y() - row->baseline()) < top_y && top_y > 0) {
-               if (row->height() < vheight && row->height() > vheight / 4) {
-                       newtop = cursor.y() - row->baseline();
+       } else if (int(cursor.y() - row.baseline()) < top_y && top_y > 0) {
+               if (row.height() < vheight && row.height() > vheight / 4) {
+                       newtop = cursor.y() - row.baseline();
                } else {
                        // scroll up
                        newtop = cursor.y() - vheight / 2;
@@ -316,6 +318,8 @@ void LyXScreen::redraw(BufferView & bv)
                        LColor::bottomarea);
        }
 
+       lyxerr << "Redraw screen" << endl;
+
        expose(0, 0, workarea().workWidth(), workarea().workHeight());
 
        workarea().getPainter().end();