bug 2034 (part 2): bad placement of cursor when entering math macro explicitely

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10675 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-12-20 16:24:17 +00:00
parent 5846f51332
commit ba4529af10
2 changed files with 11 additions and 3 deletions

View 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:

View 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));
}