fix bug 2034

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10726 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2006-01-11 17:08:50 +00:00
parent 0711d8e045
commit 1b411d8e9c
5 changed files with 37 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2006-01-11 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* cursor.C (macroModeClose): returns true if an inset actually got
inserted; revert faulty fix to bug 2034.
2006-01-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* tabular.C (getLabelList): remove (not used anymore).

View File

@ -825,10 +825,10 @@ bool LCursor::down()
}
void LCursor::macroModeClose()
bool LCursor::macroModeClose()
{
if (!inMacroMode())
return;
return false;
MathUnknownInset * p = activeMacro();
p->finalize();
string const s = p->name();
@ -837,7 +837,7 @@ void LCursor::macroModeClose()
// do nothing if the macro name is empty
if (s == "\\")
return;
return false;
// prevent entering of recursive macros
// FIXME: this is only a weak attempt... only prevents immediate
@ -847,11 +847,8 @@ void LCursor::macroModeClose()
if (macro && macro->getInsetName() == name)
lyxerr << "can't enter recursive macro" << endl;
// 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));
plainInsert(createMathInset(name));
return true;
}

View File

@ -256,8 +256,10 @@ public:
/// in pixels from top of screen
void setScreenPos(int x, int y);
/// current offset in the top cell
/// interpret name a name of a macro
void macroModeClose();
/// interpret name a name of a macro. Returns true if
/// something got inserted.
bool macroModeClose();
/// are we currently typing the name of a macro?
bool inMacroMode() const;
/// get access to the macro we are currently typing

View File

@ -1,8 +1,14 @@
2006-01-11 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_nestinset.C (doDispatch/LFUN_SELFINSERT): when inserting a
space and macromode is on, try to put the cursor inside the newly
created inset (bug 2034).
2006-01-10 Martin Vermeer <martin.vermeer@hut.fi>
* math_hullinset (doDispatch): fix default label setting (eq:)
2006-01-01 <larsbj@gullik.net>
2006-01-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* command_inset.C (editXY): unused parameters
@ -62,8 +68,8 @@
2005-10-13 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* math_gridinset.[Ch] (eolString, write): Output \\ at the end of the last
line if it is empty (fixes bug 2067)
* math_gridinset.[Ch] (eolString, write): Output \\ at the end of
the last line if it is empty (fixes bug 2067)
* math_hullinset.[Ch] (eolString): Adjust to the changes above
* math_hullinset.C (delRow): Allow to delete the last dummy row
* math_parser.C (delEmptyLastRow): Delete the last dummy row.

View File

@ -340,7 +340,7 @@ int MathNestInset::latex(Buffer const &, std::ostream & os,
}
void MathNestInset::notifyCursorLeaves(LCursor & /*cur*/)
void MathNestInset::notifyCursorLeaves(LCursor & cur)
{
#ifdef WITH_WARNINGS
#warning look here
@ -669,7 +669,19 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
// undoes the complete macro, not only the last character.
if (!cur.inMacroMode())
recordUndo(cur);
if (!interpret(cur, cmd.argument[0])) {
// spacial handling of space. If we insert an inset
// via macro mode, we want to put the cursor inside it
// if relevant. Think typing "\frac<space>".
if (cmd.argument[0] == ' '
&& cur.inMacroMode() && cur.macroName() != "\\"
&& cur.macroModeClose()) {
MathAtom const atom = cur.prevAtom();
if (atom->asNestInset() && atom->nargs() > 0) {
cur.posLeft();
cur.pushLeft(*cur.nextInset());
}
} else if (!interpret(cur, cmd.argument[0])) {
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
cur.undispatched();
}