{ "\\auto_number", LyXRC::RC_AUTO_NUMBER },
{ "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
{ "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
+ { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
{ "\\autosave", LyXRC::RC_AUTOSAVE },
{ "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
{ "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
completion_popup_text = false;
completion_popup_delay = 2.0;
completion_popup_after_complete = true;
+ autocorrection_math = false;
completion_inline_math = true;
completion_inline_text = false;
completion_inline_dots = -1;
lexrc >> completion_inline_dots;
break;
+ case RC_AUTOCORRECTION_MATH:
+ lexrc >> autocorrection_math;
+ break;
+
case RC_COMPLETION_POPUP_DELAY:
lexrc >> completion_popup_delay;
break;
}
if (tag != RC_LAST)
break;
+ case RC_AUTOCORRECTION_MATH:
+ if (ignore_system_lyxrc ||
+ autocorrection_math != system_lyxrc.autocorrection_math) {
+ os << "\\autocorrection_math "
+ << convert<string>(autocorrection_math) << '\n';
+ }
+ if (tag != RC_LAST)
+ break;
case RC_COMPLETION_POPUP_DELAY:
if (ignore_system_lyxrc ||
completion_popup_delay != system_lyxrc.completion_popup_delay) {
str = _("Use \"...\" to shorten long completions.");
break;
+ case RC_AUTOCORRECTION_MATH:
+ str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
+ break;
+
case RC_NUMLASTFILES:
str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
maxlastfiles);
enum LyXRCTags {
RC_ACCEPT_COMPOUND = 1,
RC_ALT_LANG,
+ RC_AUTOCORRECTION_MATH,
RC_PLAINTEXT_LINELEN,
RC_PLAINTEXT_ROFF_COMMAND,
RC_AUTOREGIONDELETE,
///
int completion_inline_dots;
///
+ bool autocorrection_math;
+ ///
double completion_popup_delay;
///
bool completion_popup_math;
#include <config.h>
-//#define AUTOCORRECT
-
#include "InsetMathNest.h"
#include "InsetMathArray.h"
#include "InsetMathSpace.h"
#include "InsetMathSymbol.h"
#include "InsetMathUnknown.h"
-#ifdef AUTOCORRECT
#include "MathAutoCorrect.h"
-#endif
#include "MathCompletionList.h"
#include "MathData.h"
#include "MathFactory.h"
return true;
}
- // This is annoying as one has to press <space> far too often.
- // Disable it.
-#ifdef AUTOCORRECT
- // leave autocorrect mode if necessary
- if (c == ' ' && cur.autocorrect()) {
- cur.autocorrect() = false;
- cur.message(_("Autocorrect Off ('!' to enter)"));
- return true;
- }
- if (c == '!' && !cur.autocorrect()) {
- cur.autocorrect() = true;
- cur.message(_("Autocorrect On (<space> to exit)"));
- return true;
- }
-#endif
+ // leave autocorrect mode if necessary
+ if (lyxrc.autocorrection_math && c == ' ' && cur.autocorrect()) {
+ cur.autocorrect() = false;
+ cur.message(_("Autocorrect Off ('!' to enter)"));
+ return true;
+ }
+ if (lyxrc.autocorrection_math && c == '!' && !cur.autocorrect()) {
+ cur.autocorrect() = true;
+ cur.message(_("Autocorrect On (<space> to exit)"));
+ return true;
+ }
// just clear selection on pressing the space bar
if (cur.selection() && c == ' ') {
}
-#ifdef AUTOCORRECT
// try auto-correction
- if (cur.autocorrect() && cur.pos() != 0 && math_autocorrect(cur.prevAtom(), c))
+ if (lyxrc.autocorrection_math && 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);
-#ifdef AUTOCORRECT
- if (!cur.autocorrect())
- cur.message(_("Autocorrect Off ('!' to enter)"));
- else
- cur.message(_("Autocorrect On (<space> to exit)"));
-#endif
+ if (lyxrc.autocorrection_math) {
+ if (!cur.autocorrect())
+ cur.message(_("Autocorrect Off ('!' to enter)"));
+ else
+ cur.message(_("Autocorrect On (<space> to exit)"));
+ }
return true;
}