]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
fix crash when collapsing ert with cursor inside
[lyx.git] / src / paragraph.C
index 755966eff1e815076a095c71bae089de2deaf9ee..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;
@@ -901,9 +903,9 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
        }
 
        LyXFont basefont;
-       
+
        LaTeXFeatures features(buf, bparams, runparams.nice);
-       
+
        // output change tracking marks only if desired,
        // if dvipost is installed,
        // and with dvi/ps (other formats don't work)
@@ -1020,7 +1022,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
 
                Change::Type change = pimpl_->lookupChange(i);
 
-               column += Changes::latexMarkChange(os, running_change, 
+               column += Changes::latexMarkChange(os, running_change,
                        change, output);
                running_change = change;
 
@@ -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;
        }
 
@@ -1878,4 +1880,3 @@ void Paragraph::dump() const
                rows_[i].dump();
        }
 }
-