]> git.lyx.org Git - features.git/commitdiff
Fix, but keep disabled, mathed autocorrect
authorMartin Vermeer <martin.vermeer@hut.fi>
Fri, 19 Dec 2008 10:26:33 +0000 (10:26 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Fri, 19 Dec 2008 10:26:33 +0000 (10:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27927 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathNest.cpp

index d7d641515d82c9a128dd0d098effef977ba00be1..ef2d659d8d355b2f00bdd2a0de8884ec2091b37c 100644 (file)
@@ -10,6 +10,8 @@
 
 #include <config.h>
 
+//#define AUTOCORRECT
+
 #include "InsetMathNest.h"
 
 #include "InsetMathArray.h"
@@ -25,6 +27,9 @@
 #include "InsetMathSpace.h"
 #include "InsetMathSymbol.h"
 #include "InsetMathUnknown.h"
+#ifdef AUTOCORRECT
+#include "MathAutoCorrect.h"
+#endif
 #include "MathCompletionList.h"
 #include "MathData.h"
 #include "MathFactory.h"
@@ -1513,10 +1518,10 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
        // This is annoying as one has to press <space> far too often.
        // Disable it.
 
-#if 0
+#ifdef AUTOCORRECT
                // leave autocorrect mode if necessary
-               if (autocorrect() && c == ' ') {
-                       autocorrect() = false;
+               if (cur.autocorrect() && c == ' ') {
+                       cur.autocorrect() = false;
                        return true;
                }
 #endif
@@ -1616,9 +1621,11 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
        }
 
 
+#ifdef AUTOCORRECT
        // try auto-correction
-       //if (autocorrect() && hasPrevAtom() && math_autocorrect(prevAtom(), c))
-       //      return true;
+       if (cur.autocorrect() && cur.pos() != 0 && math_autocorrect(cur.prevAtom(), c))
+               return true;
+#endif
 
        // no special circumstances, so insert the character without any fuss
        cur.insert(c);