From d6f30aac95c64f8e93dd9b4058d608edc40d4865 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Fri, 19 Dec 2008 10:26:33 +0000 Subject: [PATCH] Fix, but keep disabled, mathed autocorrect git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27927 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathNest.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index d7d641515d..ef2d659d8d 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -10,6 +10,8 @@ #include +//#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 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);