Fix bug #6246: InsetMathKern is broken

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31483 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-09-28 22:11:02 +00:00
parent caf70b9960
commit 391659b5af
3 changed files with 19 additions and 4 deletions

View File

@ -57,13 +57,19 @@ void InsetMathKern::draw(PainterInfo &, int, int) const
void InsetMathKern::write(WriteStream & os) const void InsetMathKern::write(WriteStream & os) const
{ {
os << "\\kern" << from_utf8(wid_.asLatexString()) << ' '; if (wid_.empty())
os << "\\kern" << ' ';
else
os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
} }
void InsetMathKern::normalize(NormalStream & os) const void InsetMathKern::normalize(NormalStream & os) const
{ {
os << "[kern " << from_utf8(wid_.asLatexString()) << ']'; if (wid_.empty())
os << "[kern]";
else
os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
} }

View File

@ -1552,17 +1552,24 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
else if (t.cs() == "kern") { else if (t.cs() == "kern") {
// FIXME: A hack... // FIXME: A hack...
docstring s; docstring s;
int num_tokens = 0;
while (true) { while (true) {
Token const & t = getToken(); Token const & t = getToken();
++num_tokens;
if (!good()) { if (!good()) {
putback(); s.clear();
while (num_tokens--)
putback();
break; break;
} }
s += t.character(); s += t.character();
if (isValidLength(to_utf8(s))) if (isValidLength(to_utf8(s)))
break; break;
} }
cell->push_back(MathAtom(new InsetMathKern(s))); if (s.empty())
cell->push_back(MathAtom(new InsetMathKern));
else
cell->push_back(MathAtom(new InsetMathKern(s)));
} }
else if (t.cs() == "label") { else if (t.cs() == "label") {

View File

@ -150,6 +150,8 @@ What's new
- Fix the painting of RTL text. All rows except the last one of a - Fix the painting of RTL text. All rows except the last one of a
paragraph were painted slightly too far to the left (bug 3997). paragraph were painted slightly too far to the left (bug 3997).
- Fix the \kern primitive in mathed (bug 6246).
* DOCUMENTATION AND LOCALIZATION * DOCUMENTATION AND LOCALIZATION