X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathNest.cpp;h=0b24a1d74bc19bb5350f77e70e22bf8c2414f990;hb=efaae780dbbe3685e26e040ed4255e5abf268106;hp=860d265e53c205cf6d21b2827d15889957292d9c;hpb=1fa39e1f953434700f1af4fb2eb9b193dd1709df;p=lyx.git diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 860d265e53..0b24a1d74b 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -706,6 +706,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) act == LFUN_UP_SELECT; cur.selHandle(select); + // handle autocorrect: + cur.autocorrect() = false; + cur.message(_("Autocorrect Off ('!' to enter)")); + // go up/down bool up = act == LFUN_UP || act == LFUN_UP_SELECT; bool successful = cur.upDownInMath(up); @@ -806,7 +810,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) if (cur.pos() == 0) // May affect external cell: cur.recordUndoInset(); - else + else if (!cur.inMacroMode()) cur.recordUndoSelection(); // if the inset can not be removed from within, delete it if (!cur.backspace()) { @@ -848,14 +852,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_SELF_INSERT: if (cmd.argument().size() != 1) { - // use a group because interpretString() might - // record an extra undo step - cur.beginUndoGroup(); cur.recordUndoSelection(); docstring const arg = cmd.argument(); if (!interpretString(cur, arg)) cur.insert(arg); - cur.endUndoGroup(); break; } // Don't record undo steps if we are in macro mode and thus @@ -1445,6 +1445,10 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd, flag.setEnabled(false); break; + case LFUN_CAPTION_INSERT: + flag.setEnabled(false); + break; + case LFUN_SPACE_INSERT: { docstring const & name = cmd.argument(); if (name == "visible") @@ -1667,8 +1671,6 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c) cur.cell().erase(cur.pos()); cur.plainInsert(MathAtom( new InsetMathBig(name.substr(1), delim))); - // end undo group that was opened before p was created - cur.endUndoGroup(); return true; } } @@ -1711,13 +1713,11 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c) //lyxerr << "starting with macro" << endl; bool reduced = cap::reduceSelectionToOneCell(cur); if (reduced || !cur.selection()) { + cur.recordUndoInset(); docstring const safe = cap::grabAndEraseSelection(cur); - if (!cur.inRegexped()) { - // open a group because interpretString() might - // record an extra undo step when finalizing - cur.beginUndoGroup(); + if (!cur.inRegexped()) cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false))); - } else + else cur.niceInsert(createInsetMath("backslash", buf)); } return true; @@ -2072,7 +2072,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur) } sort(locals.begin(), locals.end()); - if (globals.size() > 0) + if (!globals.empty()) return; // fill in global macros @@ -2107,6 +2107,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur) globals.push_back(from_ascii("\\root")); globals.push_back(from_ascii("\\tabular")); globals.push_back(from_ascii("\\stackrel")); + globals.push_back(from_ascii("\\stackrelthree")); globals.push_back(from_ascii("\\binom")); globals.push_back(from_ascii("\\choose")); globals.push_back(from_ascii("\\brace"));