From cc5b1b9def33bdbcdbc4fb6151c10632886f6393 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 9 Nov 2001 13:51:24 +0000 Subject: [PATCH] let '^' and '_' end "MacroMode" immediately git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2996 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_cursor.C | 53 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index d43f118cb0..d44609d64c 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -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(); -- 2.39.2