]> git.lyx.org Git - features.git/commitdiff
bug 2034 (part 2): bad placement of cursor when entering math macro explicitely
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 20 Dec 2005 16:24:17 +0000 (16:24 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 20 Dec 2005 16:24:17 +0000 (16:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10675 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/cursor.C

index 6313170c48c18cf910e559d116747d7f6bccd2d2..c4ec81f3032b3c8db7093debd92ed04afb589aff 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-19  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * cursor.C (macroModeClose): set the cursor inside the new math
+       atom if relevant (think \frac{}{}) (bug 2034)
+
 2005-12-19  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * lyxtext.h:
index 61559ffa22e1c07ca478a536a6ea1123bedcdbc3..111fb78a9a977ab6aca1ae37f9db0af73e50e47b 100644 (file)
@@ -839,16 +839,19 @@ void LCursor::macroModeClose()
        if (s == "\\")
                return;
 
-       string const name = s.substr(1);
-
        // prevent entering of recursive macros
        // FIXME: this is only a weak attempt... only prevents immediate
        // recursion
+       string const name = s.substr(1);
        InsetBase const * macro = innerInsetOfType(InsetBase::MATHMACRO_CODE);
        if (macro && macro->getInsetName() == name)
                lyxerr << "can't enter recursive macro" << endl;
 
-       plainInsert(createMathInset(name));
+       // Going back and forth between LCursor and mathed is a bit
+       // ridiculous, but the alternative was to duplicate the code
+       // in MathNestInset::doDispatch/LFUN_INSERT_MATH (which puts
+       // the cursor in the newly created inset). (JMarc 2005/12/20)
+       dispatch(FuncRequest(LFUN_INSERT_MATH, s));
 }