]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
* src/frontends/qt4/QTocDialog.C (updateGui):
[lyx.git] / src / text2.C
index e47be66fd66377981502f4e7099b872c88927773..6b13d5b5d82956fad0523b068baee809f4e4e6ea 100644 (file)
@@ -981,7 +981,8 @@ bool LyXText::cursorUp(LCursor & cur)
        // Tell BufferView to test for FitCursor in any case!
        cur.updateFlags(Update::FitCursor);
 
-       ParagraphMetrics const & pm = cur.bv().parMetrics(this, cur.pit());
+       TextMetrics const & tm = cur.bv().textMetrics(this);
+       ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
 
        int row;
        int const x = cur.targetX();
@@ -1009,19 +1010,20 @@ bool LyXText::cursorUp(LCursor & cur)
                        ++dummy.pos();
 
                cur.bv().checkDepm(dummy, old);
+               return false;
        }
 
        bool updateNeeded = false;
 
        if (row > 0) {
                updateNeeded |= setCursor(cur, cur.pit(),
-                       x2pos(cur.bv(), cur.pit(), row - 1, x));
+                       tm.x2pos(cur.pit(), row - 1, x));
        } else if (cur.pit() > 0) {
                --cur.pit();
                //cannot use 'par' now
                ParagraphMetrics const & pmcur = cur.bv().parMetrics(this, cur.pit());
                updateNeeded |= setCursor(cur, cur.pit(),
-                       x2pos(cur.bv(), cur.pit(), pmcur.rows().size() - 1, x));
+                       tm.x2pos(cur.pit(), pmcur.rows().size() - 1, x));
        }
 
        cur.x_target() = x;
@@ -1035,7 +1037,8 @@ bool LyXText::cursorDown(LCursor & cur)
        // Tell BufferView to test for FitCursor in any case!
        cur.updateFlags(Update::FitCursor);
 
-       ParagraphMetrics const & pm = cur.bv().parMetrics(this, cur.pit());
+       TextMetrics const & tm = cur.bv().textMetrics(this);
+       ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
 
        int row;
        int const x = cur.targetX();
@@ -1074,11 +1077,11 @@ bool LyXText::cursorDown(LCursor & cur)
 
        if (row + 1 < int(pm.rows().size())) {
                updateNeeded |= setCursor(cur, cur.pit(),
-                       x2pos(cur.bv(), cur.pit(), row + 1, x));
+                       tm.x2pos(cur.pit(), row + 1, x));
        } else if (cur.pit() + 1 < int(paragraphs().size())) {
                ++cur.pit();
                updateNeeded |= setCursor(cur, cur.pit(),
-                       x2pos(cur.bv(), cur.pit(), 0, x));
+                       tm.x2pos(cur.pit(), 0, x));
        }
 
        cur.x_target() = x;