From ba4529af100989aed6cca9adac92d38d9171bacc Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 20 Dec 2005 16:24:17 +0000 Subject: [PATCH] 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 --- src/ChangeLog | 5 +++++ src/cursor.C | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6313170c48..c4ec81f303 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-12-19 Jean-Marc Lasgouttes + + * cursor.C (macroModeClose): set the cursor inside the new math + atom if relevant (think \frac{}{}) (bug 2034) + 2005-12-19 Martin Vermeer * lyxtext.h: diff --git a/src/cursor.C b/src/cursor.C index 61559ffa22..111fb78a9a 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -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)); } -- 2.39.5