* move MathIter::Copy(int, int) to MathArray::shrink(pos, pos)
* several files: subsequent changes
+
+ * math_cursor.C: make selarray a proper MathArray
2001-02-19 Dekel Tsur <dekelts@tau.ac.il>
#include "math_accentinset.h"
#include "mathed/support.h"
-static MathedArray * selarray = 0;
+static MathedArray selarray;
using std::endl;
anchor = 0;
lastcode = LM_TC_MIN;
SetPar(p);
- // selarray = 0;
if (!MathMacroTable::built)
MathMacroTable::mathMTable.builtinMacros();
}
if (selection) {
if (MathIsActive(t)) {
SelCut();
- static_cast<MathParInset*>(p)->setData(selarray);
+ static_cast<MathParInset*>(p)->setData(&selarray);
} else
SelDel();
}
MathedArray * a = p->GetData();
p->clear();
Delete();
- cursor->Merge(a);
- cursor->Adjust();
+ if (!a->empty()) {
+ cursor->Merge(a);
+ cursor->Adjust();
+ }
return true;
}
int p1 = (cursor->getPos() < selpos) ? cursor->getPos() : selpos;
int p2 = (cursor->getPos() > selpos) ?
cursor->getPos() : selpos;
- selarray = new MathedArray(*(cursor->GetData()));
- selarray->shrink(p1, p2);
+ selarray = *(cursor->GetData());
+ selarray.shrink(p1, p2);
cursor->Adjust();
SelClear();
}
int p1 = (cursor->getPos() < selpos) ? cursor->getPos() : selpos;
int p2 = (cursor->getPos() > selpos) ? cursor->getPos() : selpos;
- selarray = new MathedArray(*(cursor->GetData()));
- selarray->shrink(p1, p2);
+ selarray = *(cursor->GetData());
+ selarray.shrink(p1, p2);
cursor->Clean(selpos);
cursor->Adjust();
SelClear();
if (selection)
SelDel();
- if (selarray) {
- cursor->Merge(selarray);
+ if (!selarray.empty()) {
+ cursor->Merge(&selarray);
cursor->Adjust();
}
}