]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
Fix bug 5802 (http://bugzilla.lyx.org/show_bug.cgi?id=5802)
[lyx.git] / src / mathed / InsetMathNest.cpp
index 2aad5c93edfcfbd7ce9ef2820a758bac8dfd322e..4f3656a7364e4b6dee7c582fe3cf3f6ec8187d01 100644 (file)
@@ -980,6 +980,12 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
+       case LFUN_MATH_FONT_STYLE: {
+               FuncRequest fr = FuncRequest(LFUN_MATH_INSERT, '\\' + cmd.argument());
+               doDispatch(cur, fr);
+               break;
+       }
+
        case LFUN_MATH_SIZE: {
                FuncRequest fr = FuncRequest(LFUN_MATH_INSERT, cmd.argument());
                doDispatch(cur, fr);
@@ -1253,18 +1259,22 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
                flag.setEnabled(currentMode() != TEXT_MODE);
                break;
 
-       case LFUN_MATH_INSERT: {
+       case LFUN_MATH_FONT_STYLE: {
                bool const textarg =
-                       arg == "\\textbf"   || arg == "\\textsf" ||
-                       arg == "\\textrm"   || arg == "\\textmd" ||
-                       arg == "\\textit"   || arg == "\\textsc" ||
-                       arg == "\\textsl"   || arg == "\\textup" ||
-                       arg == "\\texttt"   || arg == "\\textbb" ||
-                       arg == "\\textnormal";
+                       arg == "textbf"   || arg == "textsf" ||
+                       arg == "textrm"   || arg == "textmd" ||
+                       arg == "textit"   || arg == "textsc" ||
+                       arg == "textsl"   || arg == "textup" ||
+                       arg == "texttt"   || arg == "textbb" ||
+                       arg == "textnormal";
                flag.setEnabled(currentMode() != TEXT_MODE || textarg);
                break;
        }
 
+       case LFUN_MATH_INSERT:
+               flag.setEnabled(currentMode() != TEXT_MODE);
+               break;
+
        case LFUN_MATH_MATRIX:
                flag.setEnabled(currentMode() == MATH_MODE);
                break;
@@ -1624,7 +1634,8 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
 
 
        // try auto-correction
-       if (lyxrc.autocorrection_math && cur.autocorrect() && cur.pos() != 0 && math_autocorrect(cur.prevAtom(), c))
+       if (lyxrc.autocorrection_math && cur.autocorrect() && cur.pos() != 0
+                 && math_autocorrect(cur.prevAtom(), c))
                return true;
 
        // no special circumstances, so insert the character without any fuss
@@ -1917,6 +1928,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur)
        globals.push_back(from_ascii("\\color"));
        globals.push_back(from_ascii("\\normalcolor"));
        globals.push_back(from_ascii("\\textcolor"));
+       globals.push_back(from_ascii("\\cfrac"));
        globals.push_back(from_ascii("\\dfrac"));
        globals.push_back(from_ascii("\\tfrac"));
        globals.push_back(from_ascii("\\dbinom"));