]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
rev 14409 committed the file from a wrong tree, here is the file.
[lyx.git] / src / BufferView_pimpl.C
index 95d85786b47a2fe0ef245df6485545dd28a63489..859b2f57938c0b41629c5d5129a26175ecf904b3 100644 (file)
@@ -677,6 +677,8 @@ void BufferView::Pimpl::update(Update::flags flags)
                bool singlePar = flags & Update::SinglePar;
                needs_redraw_ = flags & (Update::Force | Update::SinglePar);
 
+               updateMetrics(singlePar);
+
                if ((flags & (Update::FitCursor | Update::MultiParSel))
                    && (fitCursor() || multiParSel())) {
                        needs_redraw_ = true;
@@ -1413,16 +1415,18 @@ void BufferView::Pimpl::updateMetrics(bool singlepar)
 
        // The coordinates of all these paragraphs are correct, cache them
        int y = y1;
+       CoordCache::InnerParPosCache & parPos = theCoords.parPos()[text];
        for (lyx::pit_type pit = pit1; pit <= pit2; ++pit) {
-               y += text->getPar(pit).ascent();
-               theCoords.parPos()[text][pit] = Point(0, y);
+               Paragraph & par = text->getPar(pit);
+               y += par.ascent();
+               parPos[pit] = Point(0, y);
                if (singlepar && pit == cursor_.bottom().pit()) {
                        // In Single Paragraph mode, collect here the
                        // y1 and y2 of the (one) paragraph the cursor is in
-                       y1 = y - text->getPar(pit).ascent();
-                       y2 = y + text->getPar(pit).descent();
+                       y1 = y - par.ascent();
+                       y2 = y + par.descent();
                }
-               y += text->getPar(pit).descent();
+               y += par.descent();
        }
 
        if (singlepar) {