]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.C
fix reading the author field.
[lyx.git] / src / CutAndPaste.C
index 2ed08ebf0af767acdbefa06733b1e3b6a63a79a6..4f422ae268d751360fd428b581edf150ef2c4306 100644 (file)
@@ -170,7 +170,7 @@ pasteSelectionHelper(Buffer const & buffer, ParagraphList & pars,
                        switch (lit->inset->lyxCode()) {
                        case InsetOld::TABULAR_CODE: {
                                InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
-                               it->buffer(const_cast<Buffer*>(&buffer));
+                               it->buffer(&buffer);
                                break;
                        }
 
@@ -455,7 +455,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
                                bp.textclass);
                }
 
-               boost::tie(endpit, endpos) = 
+               boost::tie(endpit, endpos) =
                        eraseSelectionHelper(bp,
                                text->paragraphs(),
                                begpit, endpit,
@@ -639,12 +639,9 @@ void replaceWord(LCursor & cur, string const & replacestring)
 
 void eraseSelection(LCursor & cur)
 {
-       //lyxerr << "LCursor::eraseSelection" << endl;
+       //lyxerr << "LCursor::eraseSelection begin: " << cur << endl;
        CursorSlice const & i1 = cur.selBegin();
        CursorSlice const & i2 = cur.selEnd();
-#ifdef WITH_WARNINGS
-#warning FIXME
-#endif
        if (i1.inset().asMathInset()) {
                if (i1.idx() == i2.idx()) {
                        i1.cell().erase(i1.pos(), i2.pos());
@@ -658,10 +655,12 @@ void eraseSelection(LCursor & cur)
                                        p->cell(p->index(row, col)).clear();
                }
                cur.back() = i1;
+               cur.pos() = 0; // We've deleted the whole cell. Only pos 0 is valid.
+               cur.resetAnchor();
        } else {
                lyxerr << "can't erase this selection 1" << endl;
        }
-       //lyxerr << "LCursor::eraseSelection end" << endl;
+       //lyxerr << "LCursor::eraseSelection end: " << cur << endl;
 }