]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
fix a crash when the inset containing the new word at cursor is deleted
[lyx.git] / src / mathed / InsetMathNest.cpp
index 784c378c1626dbe74845d8d551df7b92fc1a9ca9..1c6437d9737f907386b87ed5390775e3ad7aa36a 100644 (file)
@@ -394,12 +394,14 @@ void InsetMathNest::normalize(NormalStream & os) const
 }
 
 
-int InsetMathNest::latex(odocstream & os, OutputParams const & runparams) const
+int InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
 {
-       WriteStream wi(os, runparams.moving_arg, true,
+       WriteStream wi(os.os(), runparams.moving_arg, true,
                       runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
                       runparams.encoding);
+       wi.canBreakLine(os.canBreakLine());
        write(wi);
+       os.canBreakLine(wi.canBreakLine());
        return wi.line();
 }
 
@@ -1355,6 +1357,12 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
                break;
        }
 
+       case LFUN_MATH_MODE:
+               // forbid "math-mode on" in math mode to prevent irritating
+               // behaviour of menu entries (bug 6709)
+               flag.setEnabled(currentMode() == TEXT_MODE || arg != "on");
+               break;
+
        case LFUN_MATH_INSERT:
                flag.setEnabled(currentMode() != TEXT_MODE);
                break;