let '^' and '_' end "MacroMode" immediately

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2996 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-11-09 13:51:24 +00:00
parent 9d0ba3ddf2
commit cc5b1b9def

View File

@ -1309,7 +1309,34 @@ void MathCursor::interpret(string const & s)
void MathCursor::interpret(char c)
{
//lyxerr << "interpret 2: '" << c << "'\n";
if (c == '^' || c == '_') {
macroModeClose();
const bool up = (c == '^');
selCut();
if (hasPrevAtom() && prevAtom()->asScriptInset()) {
prevAtom()->asScriptInset()->ensure(up);
pushRight(prevAtom());
idx() = up;
pos() = size();
} else if (hasNextAtom() && nextAtom()->asScriptInset()) {
nextAtom()->asScriptInset()->ensure(up);
pushLeft(nextAtom());
idx() = up;
pos() = 0;
} else {
plainInsert(MathAtom(new MathScriptInset(up)));
prevAtom()->asScriptInset()->ensure(up);
pushRight(prevAtom());
idx() = up;
pos() = 0;
}
selPaste();
dump("1");
return;
}
// handle macroMode
if (inMacroMode()) {
string name = macroName();
@ -1345,32 +1372,6 @@ void MathCursor::interpret(char c)
return;
}
// no macro mode
if (c == '^' || c == '_') {
const bool up = (c == '^');
selCut();
if (hasPrevAtom() && prevAtom()->asScriptInset()) {
prevAtom()->asScriptInset()->ensure(up);
pushRight(prevAtom());
idx() = up;
pos() = size();
} else if (hasNextAtom() && nextAtom()->asScriptInset()) {
nextAtom()->asScriptInset()->ensure(up);
pushLeft(nextAtom());
idx() = up;
pos() = 0;
} else {
plainInsert(MathAtom(new MathScriptInset(up)));
prevAtom()->asScriptInset()->ensure(up);
pushRight(prevAtom());
idx() = up;
pos() = 0;
}
selPaste();
dump("1");
return;
}
if (selection_)
selDel();