Make autocorrect have priority.

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"!
This commit is contained in:
Isaac Oscar Gariano 2019-05-25 11:17:41 +12:00 committed by Jean-Marc Lasgouttes
parent dd4ca3ad4c
commit 4c587fb9da

View 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;