Fix bug #6284: missing space between # and text in math mode when using \mbox

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31680 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-10-19 23:11:36 +00:00
parent ba9d500de4
commit 5484edda22

View File

@ -1777,8 +1777,15 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
if (mode == InsetMath::TEXT_MODE) { if (mode == InsetMath::TEXT_MODE) {
int num_tokens = 0; int num_tokens = 0;
docstring cmd = prevToken().asInput(); docstring cmd = prevToken().asInput();
skipSpaces(); // Check whether we have a macro
// argument, taking into account that
// it may come after some spaces.
CatCode cat = nextToken().cat(); CatCode cat = nextToken().cat();
while (cat == catSpace) {
getToken();
++num_tokens;
cat = nextToken().cat();
}
if (cat == catBegin) { if (cat == catBegin) {
int count = 0; int count = 0;
while (good() && (count || cat != catEnd)) { while (good() && (count || cat != catEnd)) {
@ -1790,6 +1797,12 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
else if (cat == catEnd) else if (cat == catEnd)
--count; --count;
} }
} else {
// No macro argument is present,
// so put back the spaces that
// we may have read.
for (; num_tokens; --num_tokens)
putback();
} }
bool is_combining; bool is_combining;
char_type c = char_type c =