]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
* src/support/unicode.C
[lyx.git] / src / BufferView.C
index 48444b80d2027e39c9774111a5677ecf31390538..ede9d687b86dc0041947a48755c2ff0116f3337d 100644 (file)
@@ -577,7 +577,6 @@ void BufferView::center()
        CursorSlice & bot = cursor_.bottom();
        TextMetrics & tm = text_metrics_[bot.text()];
        pit_type const pit = bot.pit();
-       int max_width = workWidth();
        tm.redoParagraph(pit);
        ParagraphMetrics const & pm = tm.parMetrics(pit);
        anchor_ref_ = pit;
@@ -1239,6 +1238,28 @@ void BufferView::setCursor(DocIterator const & dit)
 }
 
 
+bool BufferView::checkDepm(LCursor & cur, LCursor & old)
+{
+       // Would be wrong to delete anything if we have a selection.
+       if (cur.selection())
+               return false;
+
+       bool need_anchor_change = false;
+       bool changed = cursor_.text()->deleteEmptyParagraphMechanism(cur, old,
+               need_anchor_change);
+
+       if (need_anchor_change)
+               cur.resetAnchor();
+       
+       if (!changed)
+               return false;
+
+       updateMetrics(false);
+       buffer_->changed();
+       return true;
+}
+
+
 bool BufferView::mouseSetCursor(LCursor & cur)
 {
        BOOST_ASSERT(&cur.bv() == this);
@@ -1252,7 +1273,7 @@ bool BufferView::mouseSetCursor(LCursor & cur)
        // FIXME: move this to InsetText::notifyCursorLeaves?
        bool update = false;
        if (!badcursor && cursor_.inTexted())
-               update = cursor_.text()->deleteEmptyParagraphMechanism(cur, cursor_);
+               checkDepm(cur, cursor_);
 
        cursor_ = cur;
        cursor_.clearSelection();