commit fb655725b729dc164adeb21ea2b15ba95174ef26
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Sun Jul 23 15:50:35 2017 +0200

    Remove workaround that is not necessary anymore.
    
    This code was necessary to handle cases where the insets positions
    were not yet in cache. This cannot happen anymore thanks to the
    nodraw stage.
---
 development/PAINTING_ANALYSIS |    5 -----
 src/BufferView.cpp            |   32 ++------------------------------
 src/BufferView.h              |    3 +--
 src/Cursor.cpp                |   13 -------------
 src/Cursor.h                  |    2 --
 5 files changed, 3 insertions(+), 52 deletions(-)

diff --git a/development/PAINTING_ANALYSIS b/development/PAINTING_ANALYSIS
index 9d62593..f734edb 100644
--- a/development/PAINTING_ANALYSIS
+++ b/development/PAINTING_ANALYSIS
@@ -67,11 +67,6 @@ drawing from metrics.
 Other changes are only clean-ups.
 
 ** When a paragraph ends with a newline, compute correctly the height of the 
extra row.
-** Cleanup after complete metrics
-   Then the following can be done:
-   + remove hack in InsetMathNest::drawSelection
-   + remove Cursor::inCoordCache?
-
 ** Merging bv::updateMetrics and tm::metrics
 
 While the full metrics computation tries hard to limit the number of
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 4b78006..9e8faf9 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2995,7 +2995,7 @@ bool BufferView::needRepaint(Text const * text, Row const 
& row) const
 }
 
 
-void BufferView::checkCursorScrollOffset(PainterInfo & pi)
+void BufferView::checkCursorScrollOffset()
 {
        CursorSlice rowSlice = d->cursor_.bottom();
        TextMetrics const & tm = textMetrics(rowSlice.text());
@@ -3012,34 +3012,6 @@ void BufferView::checkCursorScrollOffset(PainterInfo & 
pi)
        // Set the row on which the cursor lives.
        setCurrentRowSlice(rowSlice);
 
-       // If insets referred to by cursor are not all in the cache, the 
positions
-       // need to be recomputed.
-       if (!d->cursor_.inCoordCache()) {
-               /** FIXME: the code below adds an extraneous computation of
-                * inset positions, and can therefore be bad for performance
-                * (think for example about a very large tabular inset.
-                * Redawing the row where it is means redrawing the whole
-                * screen).
-                *
-                * The bug that this fixes is the following: assume that there
-                * is a very large math inset. Upon entering the inset, when
-                * pressing `End', the row is not scrolled and the cursor is
-                * not visible. The extra row computation makes sure that the
-                * inset positions are correctly computed and set in the
-                * cache. This would not happen if we did not have two-stage
-                * drawing.
-                *
-                * A proper fix would be to always have proper inset positions
-                * at this point.
-                */
-               // Force the recomputation of inset positions
-               frontend::NullPainter np;
-               PainterInfo(this, np);
-               // No need to care about vertical position.
-               RowPainter rp(pi, buffer().text(), row, 
-d->horiz_scroll_offset_, 0);
-               rp.paintText();
-       }
-
        // Current x position of the cursor in pixels
        int cur_x = getPos(d->cursor_).x_;
 
@@ -3106,7 +3078,7 @@ void BufferView::draw(frontend::Painter & pain, bool 
paint_caret)
 
        // Check whether the row where the cursor lives needs to be scrolled.
        // Update the drawing strategy if needed.
-       checkCursorScrollOffset(pi);
+       checkCursorScrollOffset();
 
        switch (d->update_strategy_) {
 
diff --git a/src/BufferView.h b/src/BufferView.h
index c0f0b90..4b9f6be 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -42,7 +42,6 @@ class FuncStatus;
 class Intl;
 class Inset;
 class Length;
-class PainterInfo;
 class ParIterator;
 class ParagraphMetrics;
 class Point;
@@ -374,7 +373,7 @@ private:
 
        // Check whether the row where the cursor lives needs to be scrolled.
        // Update the drawing strategy if needed.
-       void checkCursorScrollOffset(PainterInfo & pi);
+       void checkCursorScrollOffset();
 
        /// The minimal size of the document that is visible. Used
        /// when it is allowed to scroll below the document.
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index a139a2b..0d68648 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -454,19 +454,6 @@ int Cursor::currentMode()
 }
 
 
-bool Cursor::inCoordCache() const
-{
-       // the root inset is not in cache, but we do not need it.
-       if (depth() == 1)
-               return true;
-       CoordCache::Insets const & icache = bv_->coordCache().getInsets();
-       for (size_t i = 1 ; i < depth() ; ++i)
-               if (!icache.has(&(*this)[i].inset()))
-                       return false;
-       return true;
-}
-
-
 void Cursor::getPos(int & x, int & y) const
 {
        Point p = bv().getPos(*this);
diff --git a/src/Cursor.h b/src/Cursor.h
index 5c675c4..4c9d41d 100644
--- a/src/Cursor.h
+++ b/src/Cursor.h
@@ -216,8 +216,6 @@ public:
        /// are we entering a macro name?
        bool & macromode() { return macromode_; }
 
-       /// returns true when all insets in cursor stack are in cache
-       bool inCoordCache() const;
        /// returns x,y position
        void getPos(int & x, int & y) const;
        /// return logical positions between which the cursor is situated

Reply via email to