The attached patch fixes #856 (and probably quite a few related problems
we haven't seen so far).
The problem is that spaces have to be handled differently depending on
whether we are in mat or in mathtext mode. In the first case they are
completely ignored, in the latter we have to keep one from a sequnce.
Now, determining whether we are in math mode or not was broken as it did
not take into account knowledge from enclosing insets. This patch fixes
this properly.
Ok to aplly?
Andre'
--
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)
Index: math_parser.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parser.C,v
retrieving revision 1.253
diff -u -p -r1.253 math_parser.C
--- math_parser.C 14 Oct 2002 12:56:21 -0000 1.253
+++ math_parser.C 15 Oct 2002 08:19:55 -0000
@@ -86,13 +86,13 @@ using std::atoi;
namespace {
-MathInset::mode_type asMode(string const & str)
+MathInset::mode_type asMode(MathInset::mode_type oldmode, string const & str)
{
if (str == "mathmode")
return MathInset::MATH_MODE;
if (str == "textmode" || str == "forcetext")
return MathInset::TEXT_MODE;
- return MathInset::UNDECIDED_MODE;
+ return oldmode;
}
@@ -1151,12 +1151,12 @@ void Parser::parse1(MathGridInset & grid
if (l) {
if (l->inset == "font") {
cell->push_back(createMathInset(t.cs()));
- parse(cell->back().nucleus()->cell(0),
FLAG_ITEM, asMode(l->extra));
+ parse(cell->back().nucleus()->cell(0),
+FLAG_ITEM, asMode(mode, l->extra));
}
else if (l->inset == "oldfont") {
cell->push_back(createMathInset(t.cs()));
- parse(cell->back().nucleus()->cell(0), flags,
asMode(l->extra));
+ parse(cell->back().nucleus()->cell(0), flags,
+asMode(mode, l->extra));
return;
}
@@ -1179,7 +1179,7 @@ void Parser::parse1(MathGridInset & grid
else {
MathAtom at = createMathInset(t.cs());
for (MathInset::idx_type i = 0; i <
at->nargs(); ++i)
- parse(at.nucleus()->cell(i),
FLAG_ITEM, asMode(l->extra));
+ parse(at.nucleus()->cell(i),
+FLAG_ITEM, asMode(mode, l->extra));
cell->push_back(at);
}
}