]> git.lyx.org Git - features.git/commitdiff
Make autocorrect have priority.
authorIsaac Oscar Gariano <IsaacOscar@live.com.au>
Fri, 24 May 2019 23:17:41 +0000 (11:17 +1200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:34 +0000 (15:48 +0200)
Place autocorrect at the top of `InsetMathNest::interpretChar`,
ensuring that any autocorrections that trigger on special characters
(such as '^' or '~') work. In particular, you can now make an
autocorrection from "<~" to "\preceq"!

src/mathed/InsetMathNest.cpp

index 3078ef92deccf52c909830447a1d381116976a4b..67793e7e512e7184872162188cacceee196493ce 100644 (file)
@@ -1607,6 +1607,11 @@ void InsetMathNest::lfunMouseRelease(Cursor & cur, FuncRequest & cmd)
 
 bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
 {
+        // try auto-correction
+        if (lyxrc.autocorrection_math && cur.pos() != 0
+                  && math_autocorrect(cur, c))
+                return true;
+
        //lyxerr << "interpret 2: '" << c << "'" << endl;
        docstring save_selection;
        if (c == '^' || c == '_')
@@ -1847,12 +1852,6 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
                return true;
        }
 
-
-       // try auto-correction
-       if (lyxrc.autocorrection_math && cur.pos() != 0
-                 && math_autocorrect(cur, c))
-               return true;
-
        // no special circumstances, so insert the character without any fuss
        cur.insert(c);
        return true;