]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Do not use \&@#^_~$ as lstinline delimiter, as suggested by Herbert
[lyx.git] / src / Cursor.cpp
index fd6bb6e7d8512e6a6dfb46993af2f5660a069e77..b0154fd3204c79f5cc7a10305607690d6681d6c5 100644 (file)
@@ -249,8 +249,9 @@ namespace {
        {
                odocstringstream ods;
                ods << '\n';
-               // only add blank line if we're not in an ERT inset
-               if (par.ownerCode() != Inset::ERT_CODE)
+               // only add blank line if we're not in an ERT or Listings inset
+               if (par.ownerCode() != Inset::ERT_CODE 
+                   && par.ownerCode() != Inset::LISTINGS_CODE)
                        ods << '\n';
                return ods.str();
        }
@@ -1298,51 +1299,11 @@ Font Cursor::getFont() const
 
 void Cursor::fixIfBroken()
 {
-       // find out last good level
-       Cursor copy = *this;
-       size_t newdepth = depth();
-       while (!copy.empty()) {
-               if (copy.idx() > copy.lastidx()) {
-                       lyxerr << "wrong idx " << copy.idx()
-                              << ", max is " << copy.lastidx()
-                              << " at level " << copy.depth()
-                              << ". Trying to correct this."  << endl;
-                       lyxerr << "old: " << *this << endl;
-                       newdepth = copy.depth() - 1;
-               }
-               else if (copy.pit() > copy.lastpit()) {
-                       lyxerr << "wrong pit " << copy.pit()
-                              << ", max is " << copy.lastpit()
-                              << " at level " << copy.depth()
-                              << ". Trying to correct this."  << endl;
-                       lyxerr << "old: " << *this << endl;
-                       newdepth = copy.depth() - 1;
-               }
-               else if (copy.pos() > copy.lastpos()) {
-                       lyxerr << "wrong pos " << copy.pos()
-                              << ", max is " << copy.lastpos()
-                              << " at level " << copy.depth()
-                              << ". Trying to correct this."  << endl;
-                       lyxerr << "old: " << *this << endl;
-                       newdepth = copy.depth() - 1;
-               }
-               copy.pop();
-       }
-       // shrink cursor to a size where everything is valid, possibly
-       // leaving insets
-       while (depth() > newdepth) {
-               pop();
-               lyxerr << "correcting cursor to level " << depth() << endl;
-               lyxerr << "new: " << *this << endl;
-               clearSelection();
+       if (DocIterator::fixIfBroken()) {
+                       clearSelection();
+                       resetAnchor();
        }
 }
 
 
-bool Cursor::isRTL() const
-{
-       return innerParagraph().isRightToLeftPar(bv().buffer()->params());
-}
-
-
 } // namespace lyx