]> git.lyx.org Git - features.git/commitdiff
code simplification.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 21 Dec 2007 09:45:04 +0000 (09:45 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 21 Dec 2007 09:45:04 +0000 (09:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22225 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp

index 8b720f2d33d155c2cb323613c7be1e3a97922579..1ccc1c3c9dff698de5fe01edbf0761a867131f39 100644 (file)
@@ -387,35 +387,27 @@ void BufferView::processUpdateFlags(Update::flags flags)
                return;
        }
 
-       bool const full_metrics = flags & Update::Force;
+       bool const full_metrics = flags & Update::Force || !singleParUpdate();
 
-       if (full_metrics || !singleParUpdate()) {
-               if (flags & Update::FitCursor && fitCursor()) {
-                       showCursor();
-                       return;
-               }
+       if (full_metrics)
                // We have to update the full screen metrics.
                updateMetrics();
-       }
 
        if (!(flags & Update::FitCursor)) {
+               // Nothing to do anymore. Trigger a redraw and return
                buffer_.changed();
                return;
        }
 
-       //FIXME: updateMetrics() does not update paragraph position
+       // updateMetrics() does not update paragraph position
        // This is done at draw() time. So we need a redraw!
-
        buffer_.changed();
-       if (!fitCursor())
-               // The screen has already been updated thanks to the
-               // 'buffer_.changed()' call three line above. So no need
-               // to redraw again.
-               return;
 
-       // The screen needs to be recentered around the cursor position so
-       // refresh it:
-       showCursor();
+       if (fitCursor()) {
+               // The cursor is off screen so ensure it is visible.
+               // refresh it:
+               showCursor();
+       }
 }
 
 
@@ -691,9 +683,9 @@ void BufferView::showCursor()
                int ypos = pm.position() + offset;
                Dimension const & row_dim = d->cursor_.textRow().dimension();
                if (ypos - row_dim.ascent() < 0)
-                       scrollUp(- ypos + d->cursor_.textRow().ascent());
+                       scrollUp(- ypos + row_dim.ascent());
                else if (ypos + row_dim.descent() > height_)
-                       scrollDown(ypos - height_ + d->cursor_.textRow().descent());
+                       scrollDown(ypos - height_ + row_dim.descent());
                // else, nothing to do, the cursor is already visible so we just return.
                return;
        }