]> git.lyx.org Git - lyx.git/commitdiff
try to get same behaviour as in 1.1.6 when typing \macro{
authorAndré Pönitz <poenitz@gmx.net>
Wed, 27 Mar 2002 18:42:02 +0000 (18:42 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 27 Mar 2002 18:42:02 +0000 (18:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3856 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C

index e9cdf182f5bd6156a52372daef739a39a3ae2708..57b58e7dd109a2582b4beab70241f6e837ca829d 100644 (file)
@@ -634,13 +634,14 @@ bool MathCursor::toggleLimits()
 
 void MathCursor::macroModeClose()
 {
+       MathInset::difference_type const t = macroNamePos();
+       if (t == -1)
+               return;
        string s = macroName();
-       if (s.size()) {
-               size_type old = pos();
-               pos() -= s.size();
-               array().erase(pos(), old);
+       array().erase(t, pos());
+       pos() = t;
+       if (s != "\\")
                interpret(s);
-       }
 }
 
 
@@ -1462,18 +1463,10 @@ bool MathCursor::interpret(char c)
                        return true;
                }
 
-               if (name == "\\") {
-                       insert(c, LM_TC_TEX);
-                       macroModeClose();
-                       return true;
-               }
-
                macroModeClose();
 
-               if (c == '\\')
-                       insert(c, LM_TC_TEX);
-               else if (c != ' ')
-                       insert(c, lastcode_);
+               if (c != ' ')
+                       interpret(c);
 
                return true;
        }