]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
fix crash when collapsing ert with cursor inside
[lyx.git] / src / paragraph.C
index 28caa48fac40dcc04ec76a94f59f14113f6c614d..6420d59ec08f414ef33b4db38406517fb29460a7 100644 (file)
@@ -578,7 +578,9 @@ int Paragraph::stripLeadingSpaces()
 
        int i = 0;
        while (!empty() && (isNewline(0) || isLineSeparator(0))) {
-               pimpl_->eraseIntern(0);
+               // Set Change::Type to Change::INSERTED to quietly remove it
+               setChange(0, Change::INSERTED);
+               erase(0);
                ++i;
        }
 
@@ -702,7 +704,7 @@ InsetBibitem * Paragraph::bibitem() const
 {
        if (!insetlist.empty()) {
                InsetBase * inset = insetlist.begin()->inset;
-               if (inset->lyxCode() == InsetBase::BIBTEX_CODE)
+               if (inset->lyxCode() == InsetBase::BIBITEM_CODE)
                        return static_cast<InsetBibitem *>(inset);
        }
        return 0;
@@ -1067,7 +1069,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
 
        // Needed if there is an optional argument but no contents.
        if (body_pos > 0 && body_pos == size()) {
-               os << "]~";
+               os << "}]~";
                return_value = false;
        }