]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Fix part of bug #6127: Roundtrip Lyx->Latex->Lyx fails.
[lyx.git] / src / Cursor.cpp
index 85607b218239ebba459bacee72d5e2bee3d09397..f12f442fd89650ee314e9dda5585b60fbee2e6ce 100644 (file)
@@ -405,7 +405,10 @@ int Cursor::currentMode()
        LASSERT(!empty(), /**/);
        for (int i = depth() - 1; i >= 0; --i) {
                int res = operator[](i).inset().currentMode();
-               if (res != Inset::UNDECIDED_MODE)
+               bool locked_mode = operator[](i).inset().lockedMode();
+               // Also return UNDECIDED_MODE when the mode is locked,
+               // as in this case it is treated the same as TEXT_MODE
+               if (res != Inset::UNDECIDED_MODE || locked_mode)
                        return res;
        }
        return Inset::TEXT_MODE;
@@ -1587,7 +1590,7 @@ void Cursor::normalize()
                        << pos() << ' ' << lastpos() <<  " in idx: " << idx()
                       << " in atom: '";
                odocstringstream os;
-               WriteStream wi(os, false, true, false);
+               WriteStream wi(os, false, true, WriteStream::wsDefault);
                inset().asInsetMath()->write(wi);
                lyxerr << to_utf8(os.str()) << endl;
                pos() = lastpos();