-MathedArray * MathedIter::Copy()
-{
-#if 0
- return Copy(0, 10000);
-#else
- if (!array) {
- // lyxerr << "Math error: Attempting to copy a void array." << endl;
- return 0;
- }
-
- return new MathedArray(*array);
-#endif
-}
-
-
-MathedArray * MathedIter::Copy(int pos1, int pos2)
-{
- if (!array) {
- // lyxerr << "Math error: Attempting to copy a void array." << endl;
- return 0;
- }
-
- if (pos1 > 0 || pos2 <= array->last()) {
- ipush();
- MathedArray * t = array;
- MathedArray * a;
-
- short fc = 0;
- if (pos1 > 0 && (*array)[pos1] > ' ') {
- for (int p = pos1; p >= 0; --p) {
- if (MathIsFont((*array)[p])) {
- if (p != pos1 - 1)
- fc = (*array)[p];
- else
- --pos1;
- break;
- }
- }
- }
-
- if (pos2 > 0 && (*array)[pos2] >= ' '
- && MathIsFont((*array)[pos2 - 1]))
- --pos2;
-
- int dx = pos2 - pos1;
- a = new MathedArray;
- a->resize(dx + 1);
- // lyxerr << "VA " << pos2 << " " << pos2 << " " << dx << endl;
- array->strange_copy(a, (fc) ? 1 : 0, pos1, dx);
- if (fc) {
- (*a)[0] = fc;
- ++dx;
- }
- a->last(dx);
- (*a)[dx] = '\0';
-
- array = a;
- Reset();
-
- while (OK()) {
- if (IsInset()) {
- MathedInset * inset = GetInset();
- inset = inset->Clone();
- array->raw_pointer_insert(inset, pos + 1, sizeof(inset));
- }
- Next();
- }
- array = t;
- ipop();
-
- return a;
- }
-
- // otherwise: full copy
- return new MathedArray(*array);
-}
-
-