]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
add the background image to distribution tarball
[lyx.git] / src / Cursor.cpp
index 3ca61633a5bb0267327e9352108ed70e35c668f4..9cca7b0d26ffd4843b29ce16036d04ac9a37842b 100644 (file)
@@ -187,7 +187,7 @@ bool bruteFind(Cursor & cursor,
 }
 */
 
-
+/*
 /// moves position closest to (x, y) in given box
 bool bruteFind3(Cursor & cur, int x, int y, bool up)
 {
@@ -249,7 +249,7 @@ bool bruteFind3(Cursor & cur, int x, int y, bool up)
        cur.setCursor(best_cursor);
        return true;
 }
-
+*/
 } // namespace anon
 
 
@@ -400,10 +400,12 @@ void Cursor::dispatch(FuncRequest const & cmd0)
        for (; depth(); pop(), boundary(false)) {
                LYXERR(Debug::DEBUG, "Cursor::dispatch: cmd: "
                        << cmd0 << endl << *this);
-               // LASSERT: Is it safe to continue here, or should we return?
-               LASSERT(pos() <= lastpos(), /**/);
-               LASSERT(idx() <= lastidx(), /**/);
-               LASSERT(pit() <= lastpit(), /**/);
+
+               // In any of these cases, the cursor is invalid, and we should
+               // try to save this document rather than crash.
+               LBUFERR(pos() <= lastpos());
+               LBUFERR(idx() <= lastidx());
+               LBUFERR(pit() <= lastpit());
 
                // The common case is 'LFUN handled, need update', so make the
                // LFUN handler's life easier by assuming this as default value.
@@ -460,14 +462,14 @@ DispatchResult const & Cursor::result() const
 
 BufferView & Cursor::bv() const
 {
-       LBUFERR(bv_, _("Cursor has no BufferView!"));
+       LBUFERR(bv_);
        return *bv_;
 }
 
 
 void Cursor::pop()
 {
-       LBUFERR(depth() >= 1, _("Attempt to pop empty cursor!"));
+       LBUFERR(depth() >= 1);
        pop_back();
 }
 
@@ -1139,14 +1141,12 @@ CursorSlice Cursor::normalAnchor() const
 {
        if (!selection())
                return top();
-       if (anchor_.depth() >= depth()) {
-               // LASSERT: There have been several bugs around this code, that seem
-               // to involve failures to reset the anchor. We can at least not crash
-               // in release mode by resetting it ourselves.
-               LASSERT(false, /* */);
-               DocIterator & di = const_cast<DocIterator &>(anchor_);
-               di = *this;
-       }
+       // LASSERT: There have been several bugs around this code, that seem
+       // to involve failures to reset the anchor. We can at least not crash
+       // in release mode by resetting it ourselves.
+       LASSERT(anchor_.depth() >= depth(), 
+               const_cast<DocIterator &>(anchor_) = *this);
+
        CursorSlice normal = anchor_[depth() - 1];
        if (depth() < anchor_.depth() && top() <= normal) {
                // anchor is behind cursor -> move anchor behind the inset
@@ -2050,12 +2050,8 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
 
                        updateNeeded |= bv().checkDepm(dummy, *this);
                        updateTextTargetOffset();
-                       if (updateNeeded) {
+                       if (updateNeeded)
                                forceBufferUpdate();
-                               // DEPM may have requested a screen update
-                               this->screenUpdateFlags(
-                                       this->screenUpdate() | dummy.screenUpdate());
-                       }
                }
                return false;
        }
@@ -2080,8 +2076,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                        ++dummy.pos();
                if (bv().checkDepm(dummy, old)) {
                        updateNeeded = true;
-                       // Make sure that cur gets back whatever happened to dummy (Lgb)
-                       // This will include any screen update requested by DEPM
+                       // Make sure that cur gets back whatever happened to dummy (Lgb) 
                        operator=(dummy);
                }
        } else {