]> git.lyx.org Git - features.git/commitdiff
\backslash vs \textbackslash
authorAndré Pönitz <poenitz@gmx.net>
Thu, 22 Aug 2002 07:49:53 +0000 (07:49 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 22 Aug 2002 07:49:53 +0000 (07:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5067 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C

index df7444f328c9ce9072bc6b2df674698ccfe4239b..17d7d16c32add59e5db6084ab1e604dffd471020 100644 (file)
@@ -1159,7 +1159,7 @@ bool MathCursor::script(bool up)
        // Hack to get \\^ and \\_ working
        if (inMacroMode() && macroName() == "\\") {
                if (up)
-                       interpret("\\mathcircumflex");
+                       niceInsert(createMathInset("mathcircumflex"));
                else
                        interpret('_');
                return true;
@@ -1219,12 +1219,6 @@ bool MathCursor::interpret(char c)
                string name = macroName();
                //lyxerr << "interpret name: '" << name << "'\n";
 
-               if (name.empty() && c == '\\') {
-                       backspace();
-                       interpret("\\backslash");
-                       return true;
-               }
-
                if (isalpha(c)) {
                        activeMacro()->setName(activeMacro()->name() + c);
                        return true;
@@ -1234,10 +1228,13 @@ bool MathCursor::interpret(char c)
                if (name == "\\") {
                        // remove the '\\'
                        backspace();
-                       if (c == '\\')
-                               interpret("\\backslash");
-                       else
-                               interpret(string("\\") + c);
+                       if (c == '\\') {
+                               if (currentMode() == MathInset::TEXT_MODE)
+                                       niceInsert(createMathInset("textbackslash"));
+                               else
+                                       niceInsert(createMathInset("backslash"));
+                       } else
+                               niceInsert(createMathInset(string(1, c)));
                        return true;
                }