mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Suppress a number of illegal things in text-within-math
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9892 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8923218965
commit
6d5b9d7791
@ -1,4 +1,10 @@
|
|||||||
2005-04-25 Martin Vermeer <martin.vermeer@hut.fi>a
|
2005-05-01 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
|
* math_nestinset.C (getStatus): suppress math/text fonts,
|
||||||
|
subscripts etc. to prevent lyx access to latex-illegal stuff
|
||||||
|
in text-inside-math (mbox)
|
||||||
|
|
||||||
|
2005-04-25 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
* math_gridinset.C (doDispatch):
|
* math_gridinset.C (doDispatch):
|
||||||
* math_hullInset.C (doDispatch):
|
* math_hullInset.C (doDispatch):
|
||||||
|
@ -865,6 +865,7 @@ bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd,
|
|||||||
// the font related toggles
|
// the font related toggles
|
||||||
//string tc = "mathnormal";
|
//string tc = "mathnormal";
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
string const arg = cmd.argument;
|
||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
case LFUN_TABULAR_FEATURE:
|
case LFUN_TABULAR_FEATURE:
|
||||||
flag.enabled(false);
|
flag.enabled(false);
|
||||||
@ -924,7 +925,21 @@ bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd,
|
|||||||
case LFUN_MATH_EXTERN:
|
case LFUN_MATH_EXTERN:
|
||||||
flag.enabled(true);
|
flag.enabled(true);
|
||||||
break;
|
break;
|
||||||
|
case LFUN_INSERT_MATH: {
|
||||||
|
bool const textarg =
|
||||||
|
arg == "\\textbf" || arg == "\\textsf" ||
|
||||||
|
arg == "\\textrm" || arg == "\\textmd" ||
|
||||||
|
arg == "\\textit" || arg == "\\textsc" ||
|
||||||
|
arg == "\\textsl" || arg == "\\textup" ||
|
||||||
|
arg == "\\texttt" || arg == "\\textbb" ||
|
||||||
|
arg == "\\textnormal";
|
||||||
|
flag.enabled((currentMode() == MATH_MODE && !textarg)
|
||||||
|
|| (currentMode() == TEXT_MODE && textarg));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LFUN_INSERT_MATRIX:
|
||||||
|
flag.enabled(currentMode() == MATH_MODE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ret = false;
|
ret = false;
|
||||||
break;
|
break;
|
||||||
@ -1139,14 +1154,21 @@ bool MathNestInset::interpret(LCursor & cur, char c)
|
|||||||
return cur.pos() != cur.lastpos();
|
return cur.pos() != cur.lastpos();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '_') {
|
// These shouldn't work in text mode:
|
||||||
script(cur, false);
|
if (currentMode() != MathInset::TEXT_MODE) {
|
||||||
return true;
|
if (c == '_') {
|
||||||
}
|
script(cur, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (c == '^') {
|
if (c == '^') {
|
||||||
script(cur, true);
|
script(cur, true);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
if (c == '~') {
|
||||||
|
cur.niceInsert(createMathInset("sim"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') {
|
if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') {
|
||||||
@ -1154,10 +1176,6 @@ bool MathNestInset::interpret(LCursor & cur, char c)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '~') {
|
|
||||||
cur.niceInsert(createMathInset("sim"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// try auto-correction
|
// try auto-correction
|
||||||
//if (autocorrect() && hasPrevAtom() && math_autocorrect(prevAtom(), c))
|
//if (autocorrect() && hasPrevAtom() && math_autocorrect(prevAtom(), c))
|
||||||
|
Loading…
Reference in New Issue
Block a user