]> git.lyx.org Git - lyx.git/commitdiff
Remove extra row painting added by horizontal scroll branch
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 15 Jul 2015 20:48:49 +0000 (22:48 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 15 Jul 2015 21:12:34 +0000 (23:12 +0200)
The bug workaround added an extra repaint, which can be very bad when
editing large tables.

It turns out that the bug this is trying to fix is due to the handling
of LFUN_LINE_END in InsetMathGrid. Adding the same code as in
InsetMathNest fixes the problem.

The workaround can therefore be removed.

src/BufferView.cpp
src/mathed/InsetMathGrid.cpp

index 41d85bf400058b651e67b374c7e2785087cc5cb9..19425cc1c5e9467f16c3744530e33a1fb55db2eb 100644 (file)
@@ -46,7 +46,6 @@
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
 #include "ParIterator.h"
-#include "RowPainter.h"
 #include "Session.h"
 #include "Text.h"
 #include "TextClass.h"
@@ -2987,29 +2986,6 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi)
        // Set the row on which the cursor lives.
        setCurrentRowSlice(rowSlice);
 
-       /** 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. I
-        * am not sure why the extra row computation fixes the problem,
-        * actually.
-        *
-        * A proper fix should be found and this code should be removed.
-        */
-       // Force the recomputation of inset positions
-       bool const drawing = pi.pain.isDrawingEnabled();
-       pi.pain.setDrawingEnabled(false);
-       // No need to care about vertical position.
-       RowPainter rp(pi, buffer().text(), d->cursor_.bottom().pit(), row,
-                     -d->horiz_scroll_offset_, 0);
-       rp.paintText();
-       pi.pain.setDrawingEnabled(drawing);
-       /** END of bad code */
-
        // Current x position of the cursor in pixels
        int const cur_x = getPos(d->cursor_).x_;
 
index 2591e5d9d8dfa889ce25fa33946accece798090a..7676420d940871d812f6509b17218b906ee19cf0 100644 (file)
@@ -1655,12 +1655,13 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
-       case LFUN_LINE_BEGIN_SELECT:
        case LFUN_LINE_BEGIN:
-       case LFUN_WORD_BACKWARD_SELECT:
        case LFUN_WORD_BACKWARD:
-       case LFUN_WORD_LEFT_SELECT:
        case LFUN_WORD_LEFT:
+               cur.screenUpdateFlags(Update::Decoration | Update::FitCursor);
+       case LFUN_LINE_BEGIN_SELECT:
+       case LFUN_WORD_BACKWARD_SELECT:
+       case LFUN_WORD_LEFT_SELECT:
                cur.selHandle(act == LFUN_WORD_BACKWARD_SELECT ||
                                act == LFUN_WORD_LEFT_SELECT ||
                                act == LFUN_LINE_BEGIN_SELECT);
@@ -1679,12 +1680,13 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                }
                break;
 
-       case LFUN_WORD_FORWARD_SELECT:
        case LFUN_WORD_FORWARD:
-       case LFUN_WORD_RIGHT_SELECT:
        case LFUN_WORD_RIGHT:
-       case LFUN_LINE_END_SELECT:
        case LFUN_LINE_END:
+               cur.screenUpdateFlags(Update::Decoration | Update::FitCursor);
+       case LFUN_WORD_FORWARD_SELECT:
+       case LFUN_WORD_RIGHT_SELECT:
+       case LFUN_LINE_END_SELECT:
                cur.selHandle(act == LFUN_WORD_FORWARD_SELECT ||
                                act == LFUN_WORD_RIGHT_SELECT ||
                                act == LFUN_LINE_END_SELECT);