diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 0b7798485b..7b745a2387 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1528,7 +1528,7 @@ bool Cursor::down() } -bool Cursor::macroModeClose() +bool Cursor::macroModeClose(bool cancel) { if (!inMacroMode()) return false; @@ -1541,7 +1541,7 @@ bool Cursor::macroModeClose() cell().erase(pos()); // do nothing if the macro name is empty - if (s == "\\") + if (s == "\\" || cancel) return false; // trigger updates of macros, at least, if no full diff --git a/src/Cursor.h b/src/Cursor.h index a0f5ec14bf..a2b065b4c7 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -488,9 +488,9 @@ public: void setScreenPos(int x, int y); /// current offset in the top cell - /// interpret name a name of a macro. Returns true if - /// something got inserted. - bool macroModeClose(); + /// interpret name of a macro or ditch it if \c cancel is true. + /// Returns true if something got inserted. + bool macroModeClose(bool cancel = false); /// are we currently typing the name of a macro? bool inMacroMode() const; /// get access to the macro we are currently typing diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index fc7690dc7a..c83c722968 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -870,8 +870,12 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) if (cur.selection()) cur.clearSelection(); else { - cmd = FuncRequest(LFUN_FINISHED_FORWARD); - cur.undispatched(); + if (cur.inMacroMode()) + cur.macroModeClose(true); + else { + cmd = FuncRequest(LFUN_FINISHED_FORWARD); + cur.undispatched(); + } } break; diff --git a/status.22x b/status.22x index e43dd45afb..a91ad6bb58 100644 --- a/status.22x +++ b/status.22x @@ -152,6 +152,9 @@ What's new - Fix untranslated GUI strings on View/Update toolbar button menu (bug 11040). +- When entering a math macro name, Escape properly cancels the + operation (bug 9251). + * INTERNALS