X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Farray.C;h=48deaf73ab7066e3b125c9b91b8cb0d7bb11a3bb;hb=dff2911bda426ad439e6475f62183cedd7044801;hp=3c029857907d2b32f8f9f65063dd9835c9845763;hpb=d1633491dbef2da9d2a6252be65f01b7b0b1740a;p=features.git diff --git a/src/mathed/array.C b/src/mathed/array.C index 3c02985790..48deaf73ab 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -5,6 +5,7 @@ #include "math_inset.h" #include "math_charinset.h" #include "math_scriptinset.h" +#include "math_stringinset.h" #include "debug.h" #include "array.h" #include "mathed/support.h" @@ -171,24 +172,37 @@ string charSequence(MathArray::const_iterator it, MathArray::const_iterator end) } +MathArray MathArray::glueChars() const +{ + MathArray ar; + const_iterator it = begin(); + while (it != end()) { + if (it->nucleus() && it->nucleus()->asCharInset()) { + string s = charSequence(it, end()); + MathTextCodes c = it->nucleus()->asCharInset()->code(); + ar.push_back(MathAtom(new MathStringInset(s, c))); + it += s.size(); + } else { + ar.push_back(*it); + ++it; + } + } + return ar; +} + + void MathArray::write(MathWriteInfo & wi) const +{ + glueChars().write1(wi); +} + + +void MathArray::write1(MathWriteInfo & wi) const { for (const_iterator it = begin(); it != end(); ++it) { MathInset * p = it->nucleus(); if (!p) continue; - -/* - if (p->asCharInset()) { - MathCharInset const * c = p->asCharInset(); - // special handling for character sequences with the same code - string s = charSequence(it, end()); - c->writeHeader(os); - os << s; - c->writeTrailer(os); - it += s.size() - 1; - } else -*/ if (MathScriptInset const * q = asScript(it)) { q->write(p, wi); ++it;