]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Sanitize cursors after a buffer has been reloaded
[lyx.git] / src / BufferView.cpp
index b5bf6d6ea135af7b1c8a290ff56cd232d8ece2da..7abaea0d40c1ea00829050c1fbccf57e159d10c7 100644 (file)
@@ -2529,8 +2529,11 @@ void BufferView::resize(int width, int height)
                // Clear the paragraph height cache.
                d->par_height_.clear();
                // Redo the metrics.
-               updateMetrics();
+               updateMetrics(true);
        }
+       // metrics is OK, full drawing is necessary now
+       d->update_flags_ = (d->update_flags_ & ~Update::Force) | Update::ForceDraw;
+       d->update_strategy_ = FullScreenUpdate;
 }
 
 
@@ -2689,11 +2692,6 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
        // LFUN_FILE_OPEN generated by drag-and-drop.
        FuncRequest cmd = cmd0;
 
-       Cursor old = cursor();
-       Cursor cur(*this);
-       cur.push(buffer_.inset());
-       cur.selection(d->cursor_.selection());
-
        // Either the inset under the cursor or the
        // surrounding Text will handle this event.
 
@@ -2711,6 +2709,11 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
                return;
        }
 
+       Cursor old = cursor();
+       Cursor cur(*this);
+       cur.push(buffer_.inset());
+       cur.selection(d->cursor_.selection());
+
        // Build temporary cursor.
        Inset * inset = d->text_metrics_[&buffer_.text()].editXY(cur, cmd.x(), cmd.y());
        if (inset) {