]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
The bug-fix in revision 16531 introduced another bug. This is the right fix. I did...
[lyx.git] / src / BufferView.C
index ede9d687b86dc0041947a48755c2ff0116f3337d..927d1f1ad6a599911fed5c43c674dd1c91e1fd2b 100644 (file)
@@ -335,6 +335,10 @@ bool BufferView::multiParSel()
 
 bool BufferView::update(Update::flags flags)
 {
+       // last_inset_ points to the last visited inset. This pointer may become
+       // invalid because of keyboard editing. Since all such operations
+       // causes screen update(), I reset last_inset_ to avoid such a problem.
+       last_inset_ = 0;
        // This is close to a hot-path.
        if (lyxerr.debugging(Debug::DEBUG)) {
                lyxerr[Debug::DEBUG]
@@ -1012,6 +1016,9 @@ void BufferView::clearSelection()
        if (buffer_) {
                cursor_.clearSelection();
                xsel_cache_.set = false;
+               // The buffer did not really change, but this causes the
+               // redraw we need because we cleared the selection above.
+               buffer_->changed();
        }
 }
 
@@ -1324,6 +1331,7 @@ ViewMetricsInfo const & BufferView::viewMetricsInfo()
 }
 
 
+// FIXME: We should split-up updateMetrics() for the singlepar case.
 void BufferView::updateMetrics(bool singlepar)
 {
        LyXText & buftext = buffer_->text();
@@ -1334,6 +1342,11 @@ void BufferView::updateMetrics(bool singlepar)
                anchor_ref_ = int(buftext.paragraphs().size() - 1);
                offset_ref_ = 0;
        }
+       
+       // If the paragraph metrics has changed, we can not
+       // use the singlepar optimisation.
+       if (singlepar && tm.redoParagraph(cursor_.bottom().pit()))
+                       singlepar = false;
 
        pit_type const pit = anchor_ref_;
        int pit1 = pit;
@@ -1345,6 +1358,8 @@ void BufferView::updateMetrics(bool singlepar)
        // (if this paragraph contains insets etc., rebreaking will
        // recursively descend)
        if (!singlepar || pit == cursor_.bottom().pit())
+               // If the paragraph metrics has changed, we can not
+               // use the singlepar optimisation.
                if (tm.redoParagraph(pit))
                        singlepar = false;