]> git.lyx.org Git - features.git/commitdiff
Fix bug #5923: Resume macromode.
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 15 May 2009 22:04:41 +0000 (22:04 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 15 May 2009 22:04:41 +0000 (22:04 +0000)
When the user wants to resume a macro, delete the current one and insert a new one, which is not yet finalized.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29687 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathNest.cpp

index 8fef03f2f1da901a19231ab509550901a6c8890e..a55c0551ed8aed3500e2b9804f73e32d0d7160dd 100644 (file)
@@ -1568,6 +1568,19 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
                return true;
        }
 
+       if (cur.pos() > 0) {
+               MathMacro const * macro = cur.inset().asInsetMath()->asMacro();
+               if (macro) {
+                       // resume macro_mode
+                       docstring const & s = macro->name();
+                       cur.leaveInset(*macro);
+                       cur.plainErase();
+                       docstring safe = grabAndEraseSelection(cur);
+                       cur.insert(MathAtom(new InsetMathUnknown("\\" + s + c, safe, false)));
+                       return true;    
+               }
+       }
+
        selClearOrDel(cur);
 
        if (c == '\n') {