]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM
[lyx.git] / src / BufferView_pimpl.C
index 87bc17b337dc08f9d20164516d85a075869f9b52..d1529f798ef922ba9bd663a41e1eba58b118df31 100644 (file)
@@ -658,6 +658,17 @@ bool BufferView::Pimpl::fitCursor()
 }
 
 
+bool BufferView::Pimpl::multiParSel()
+{
+       if (!cursor_.selection())
+               return false;
+       bool ret = multiparsel_cache_;
+       multiparsel_cache_ = cursor_.selBegin().pit() != cursor_.selEnd().pit();
+       // Either this, or previous selection spans paragraphs
+       return ret || multiparsel_cache_;
+}
+
+
 void BufferView::Pimpl::update(Update::flags flags)
 {
        lyxerr[Debug::DEBUG]
@@ -682,12 +693,16 @@ void BufferView::Pimpl::update(Update::flags flags)
 
                // First drawing step
                ViewMetricsInfo vi = metrics(flags & Update::SinglePar);
-               bool forceupdate(flags & Update::Force);
+               bool forceupdate(flags & (Update::Force | Update::SinglePar));
 
                if ((flags & Update::FitCursor) && fitCursor()) {
                        forceupdate = true;
                        vi = metrics();
                }
+               if ((flags & Update::MultiParSel) && multiParSel()) {
+                       forceupdate = true;
+                       vi = metrics();
+               }
                if (forceupdate) {
                        // Second drawing step
                        screen().redraw(*bv_, vi);
@@ -907,12 +922,7 @@ void BufferView::Pimpl::trackChanges()
                buffer_->undostack().clear();
        } else {
                cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
-               bool const found = lyx::find::findNextChange(bv_);
-               if (found) {
-                       // We reset the cursor to the start of the
-                       // document, since the Changes Dialog is going
-                       // to search for the next change anyway.
-                       cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
+               if (lyx::find::findNextChange(bv_)) {
                        owner_->getDialogs().show("changes");
                        return;
                }
@@ -989,7 +999,7 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
                if (cur.result().update())
                        update(Update::FitCursor | Update::Force);
                else
-                       update();
+                       update(Update::FitCursor | Update::MultiParSel);
        }
 
        // See workAreaKeyPress
@@ -1213,7 +1223,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
        }
 
        case LFUN_MERGE_CHANGES:
-               owner_->getDialogs().show("changes");
+               if (lyx::find::findNextChange(bv_))
+                       owner_->getDialogs().show("changes");
                break;
 
        case LFUN_ACCEPT_ALL_CHANGES: {