dim.asc = 0;
dim.wid = 0;
Dimension d;
- CoordCacheBase<Inset> & coords = mi.base.bv->coordCache().insets();
+ CoordCache::Insets & coords = mi.base.bv->coordCache().insets();
for (pos_type i = 0, n = size(); i != n; ++i) {
MathAtom const & at = operator[](i);
at->metrics(mi, d);
continue;
FontInfo font = mi.base.font;
- augmentFont(font, from_ascii("mathnormal"));
+ augmentFont(font, "mathnormal");
dim.wid += mathed_string_width(font, completion);
}
// Cache the dimension.
if (inlineCompletionPos.inMathed())
inlineCompletionData = &inlineCompletionPos.cell();
- CoordCacheBase<Inset> & coords = pi.base.bv->coordCache().insets();
+ CoordCache::Insets & coords = pi.base.bv->coordCache().insets();
for (size_t i = 0, n = size(); i != n; ++i) {
MathAtom const & at = operator[](i);
coords.add(at.nucleus(), x, y);
if (completion.length() == 0)
continue;
FontInfo f = pi.base.font;
- augmentFont(f, from_ascii("mathnormal"));
+ augmentFont(f, "mathnormal");
// draw the unique and the non-unique completion part
// Note: this is not time-critical as it is
void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos)
{
MathMacro * macroInset = operator[](macroPos).nucleus()->asMacro();
+ // We store this now, because the inset pointer will be invalidated in the scond loop below
+ size_t const optionals = macroInset->optionals();
// detach all arguments
vector<MathData> detachedArgs;
// only [] after the last non-empty argument can be dropped later
size_t lastNonEmptyOptional = 0;
- for (size_t l = 0; l < detachedArgs.size() && l < macroInset->optionals(); ++l) {
+ for (size_t l = 0; l < detachedArgs.size() && l < optionals; ++l) {
if (!detachedArgs[l].empty())
lastNonEmptyOptional = l;
}
// optional arguments to be put back?
pos_type p = macroPos + 1;
size_t j = 0;
- for (; j < detachedArgs.size() && j < macroInset->optionals(); ++j) {
+ // We do not want to use macroInset below, the insert() call in
+ // the loop will invalidate it.
+ macroInset = 0;
+ for (; j < detachedArgs.size() && j < optionals; ++j) {
// another non-empty parameter follows?
bool canDropEmptyOptional = j >= lastNonEmptyOptional;
{
int x = 0;
size_type target = min(pos, size());
- CoordCacheBase<Inset> const & coords = bv->coordCache().getInsets();
+ CoordCache::Insets const & coords = bv->coordCache().getInsets();
for (size_type i = 0; i < target; ++i) {
const_iterator it = begin() + i;
if ((*it)->getChar() == ' ')
const_iterator it = begin();
int lastx = 0;
int currx = 0;
- CoordCacheBase<Inset> const & coords = bv->coordCache().getInsets();
+ CoordCache::Insets const & coords = bv->coordCache().getInsets();
// find first position after targetx
for (; currx < targetx && it != end(); ++it) {
lastx = currx;