3 * Purpose: Interaction for mathed
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
6 * Description: Math interaction for a WYSIWYG math editor.
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, Alejandro Aguilar Sierra
12 * Version: 0.8beta, Math & Lyx project.
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
19 #pragma implementation
26 #include "support/lstrings.h"
27 #include "support/LAssert.h"
31 #include "formulabase.h"
32 #include "math_arrayinset.h"
33 #include "math_braceinset.h"
34 #include "math_casesinset.h"
35 #include "math_charinset.h"
36 #include "math_cursor.h"
37 #include "math_deliminset.h"
38 #include "math_factory.h"
39 #include "math_hullinset.h"
40 #include "math_iterator.h"
41 #include "math_mathmlstream.h"
42 #include "math_parser.h"
43 #include "math_replace.h"
44 #include "math_scriptinset.h"
45 #include "math_spaceinset.h"
46 #include "math_specialcharinset.h"
47 #include "math_support.h"
61 void grab(MathCursor const & cursor)
66 cursor.getSelection(i1, i2);
67 if (i1.idx_ == i2.idx_)
68 data_.push_back(MathArray(i1.cell(), i1.pos_, i2.pos_));
70 std::vector<MathInset::idx_type> indices =
71 i1.par_->idxBetween(i1.idx_, i2.idx_);
72 for (MathInset::idx_type i = 0; i < indices.size(); ++i)
73 data_.push_back(i1.cell(indices[i]));
77 void erase(MathCursor & cursor)
81 cursor.getSelection(i1, i2);
82 if (i1.idx_ == i2.idx_)
83 i1.cell().erase(i1.pos_, i2.pos_);
85 std::vector<MathInset::idx_type> indices =
86 i1.par_->idxBetween(i1.idx_, i2.idx_);
87 for (unsigned i = 0; i < indices.size(); ++i)
88 i1.cell(indices[i]).erase();
93 void paste(MathCursor & cursor) const
95 MathArray ar = glue();
99 // glues selection to one cell
100 MathArray glue() const
103 for (unsigned i = 0; i < data_.size(); ++i)
104 ar.push_back(data_[i]);
113 std::vector<MathArray> data_;
117 Selection theSelection;
124 MathCursor::MathCursor(InsetFormulaBase * formula, bool left)
125 : formula_(formula), lastcode_(LM_TC_VAR), selection_(false)
127 left ? first() : last();
131 void MathCursor::push(MathAtom & t)
133 Cursor_.push_back(MathCursorPos(t.nucleus()));
137 void MathCursor::pushLeft(MathAtom & t)
139 //cerr << "Entering atom "; t->write(cerr, false); cerr << " left\n";
141 t->idxFirst(idx(), pos());
145 void MathCursor::pushRight(MathAtom & t)
147 //cerr << "Entering atom "; t->write(cerr, false); cerr << " right\n";
150 t->idxLast(idx(), pos());
154 bool MathCursor::popLeft()
156 //cerr << "Leaving atom "; par()->write(cerr, false); cerr << " left\n";
157 if (Cursor_.size() <= 1)
159 if (par()->asScriptInset())
160 par()->asScriptInset()->removeEmptyScripts();
166 bool MathCursor::popRight()
168 //cerr << "Leaving atom "; par()->write(cerr, false); cerr << " right\n";
169 if (Cursor_.size() <= 1)
171 if (par()->asScriptInset())
172 par()->asScriptInset()->removeEmptyScripts();
181 void MathCursor::dump(char const * what) const
183 lyxerr << "MC: " << what << "\n";
184 lyxerr << " Cursor: " << Cursor_.size() << "\n";
185 for (unsigned i = 0; i < Cursor_.size(); ++i)
186 lyxerr << " i: " << i << " " << Cursor_[i] << "\n";
187 lyxerr << " Anchor: " << Anchor_.size() << "\n";
188 for (unsigned i = 0; i < Anchor_.size(); ++i)
189 lyxerr << " i: " << i << " " << Anchor_[i] << "\n";
190 lyxerr << " sel: " << selection_ << "\n";
193 void MathCursor::dump(char const *) const {}
197 UpdatableInset * MathCursor::asHyperActiveInset() const
199 return par()->asHyperActiveInset();
203 bool MathCursor::isInside(MathInset const * p) const
205 for (unsigned i = 0; i < Cursor_.size(); ++i)
206 if (Cursor_[i].par_ == p)
212 bool MathCursor::openable(MathAtom const & t, bool sel) const
214 if (t->isHyperActive())
220 if (t->asScriptInset())
224 // we can't move into anything new during selection
225 if (Cursor_.size() == Anchor_.size())
227 if (t.nucleus() != Anchor_[Cursor_.size()].par_)
234 bool MathCursor::posLeft()
243 bool MathCursor::posRight()
252 bool MathCursor::left(bool sel)
257 lastcode_ = LM_TC_VAR;
261 lastcode_ = LM_TC_VAR;
263 if (hasPrevAtom() && openable(prevAtom(), sel)) {
264 if (prevAtom()->isHyperActive()) {
265 lyxerr << "entering hyperactive inset\n";
267 pushRight(prevAtom());
271 return posLeft() || idxLeft() || popLeft() || selection_;
275 bool MathCursor::right(bool sel)
280 lastcode_ = LM_TC_VAR;
284 lastcode_ = LM_TC_VAR;
286 if (hasNextAtom() && openable(nextAtom(), sel)) {
287 if (nextAtom()->isHyperActive()) {
288 lyxerr << "entering hyperactive inset\n";
291 nextAtom()->edit(formula()->view(), x, y, 0);
293 pushLeft(nextAtom());
297 return posRight() || idxRight() || popRight() || selection_;
301 void MathCursor::first()
304 pushLeft(formula_->par());
308 void MathCursor::last()
315 bool positionable(MathCursor::cursor_type const & cursor,
316 MathCursor::cursor_type const & anchor)
318 // avoid deeper nested insets when selecting
319 if (cursor.size() > anchor.size())
322 // anchor might be deeper, should have same path then
323 for (MathCursor::cursor_type::size_type i = 0; i < cursor.size(); ++i)
324 if (cursor[i].par_ != anchor[i].par_)
327 // position should be ok.
332 void MathCursor::setPos(int x, int y)
335 bool res = bruteFind(x, y,
336 formula()->xlow(), formula()->xhigh(),
337 formula()->ylow(), formula()->yhigh());
344 void MathCursor::home(bool sel)
349 lastcode_ = LM_TC_VAR;
350 if (!par()->idxHome(idx(), pos()))
356 void MathCursor::end(bool sel)
361 lastcode_ = LM_TC_VAR;
362 if (!par()->idxEnd(idx(), pos()))
368 void MathCursor::plainErase()
370 array().erase(pos());
374 void MathCursor::plainInsert(MathAtom const & t)
376 array().insert(pos(), t);
381 void MathCursor::insert(char c, MathTextCodes t)
383 //lyxerr << "inserting '" << c << "'\n";
384 plainInsert(MathAtom(new MathCharInset(c, t)));
388 void MathCursor::insert(MathAtom const & t)
403 void MathCursor::niceInsert(MathAtom const & t)
406 insert(t); // inserting invalidates the pointer!
407 MathAtom const & p = prevAtom();
410 right(); // do not push for e.g. MathSymbolInset
416 void MathCursor::insert(MathArray const & ar)
422 array().insert(pos(), ar);
427 void MathCursor::paste(MathArray const & ar)
431 array().insert(pos(), ar);
436 void MathCursor::backspace()
448 MathScriptInset * p = prevAtom()->asScriptInset();
450 p->removeScript(p->hasUp());
451 // Don't delete if there is anything left
452 if (p->hasUp() || p->hasDown())
461 void MathCursor::erase()
471 // delete empty cells if necessary
472 if (array().empty()) {
475 par()->idxDelete(idx(), popit, removeit);
476 if (popit && popLeft() && removeit)
484 MathScriptInset * p = nextAtom()->asScriptInset();
486 p->removeScript(p->hasUp());
487 // Don't delete if there is anything left
488 if (p->hasUp() || p->hasDown())
496 void MathCursor::delLine()
505 if (par()->nrows() > 1) {
506 // grid are the only things with more than one row...
507 lyx::Assert(par()->asGridInset());
508 par()->asGridInset()->delRow(hullRow());
511 if (idx() > par()->nargs())
512 idx() = par()->nargs();
519 bool MathCursor::up(bool sel)
524 cursor_type save = Cursor_;
532 bool MathCursor::down(bool sel)
537 cursor_type save = Cursor_;
545 bool MathCursor::toggleLimits()
549 MathScriptInset * t = nextAtom()->asScriptInset();
552 int old = t->limits();
553 t->limits(old < 0 ? 1 : -1);
554 return old != t->limits();
558 void MathCursor::macroModeClose()
560 string s = macroName();
562 size_type old = pos();
564 array().erase(pos(), old);
570 int MathCursor::macroNamePos() const
572 for (int i = pos() - 1; i >= 0; --i) {
573 MathAtom & p = array().at(i);
574 if (p->code() == LM_TC_TEX && p->getChar() == '\\')
581 string MathCursor::macroName() const
584 for (int i = macroNamePos(); i >= 0 && i < int(pos()); ++i)
585 s += array().at(i)->getChar();
590 void MathCursor::selCopy()
594 theSelection.grab(*this);
600 void MathCursor::selCut()
604 theSelection.grab(*this);
605 theSelection.erase(*this);
608 theSelection.clear();
613 void MathCursor::selDel()
617 theSelection.erase(*this);
625 void MathCursor::selPaste()
628 theSelection.paste(*this);
629 //theSelection.grab(*this);
634 void MathCursor::selHandle(bool sel)
636 if (sel == selection_)
638 //theSelection.clear();
644 void MathCursor::selStart()
647 //theSelection.clear();
654 void MathCursor::selClear()
662 void MathCursor::selGet(MathArray & ar)
668 theSelection.grab(*this);
669 ar = theSelection.glue();
674 void MathCursor::drawSelection(Painter & pain) const
681 getSelection(i1, i2);
683 if (i1.idx_ == i2.idx_) {
684 MathXArray & c = i1.xcell();
685 int x1 = c.xo() + c.pos2x(i1.pos_);
686 int y1 = c.yo() - c.ascent();
687 int x2 = c.xo() + c.pos2x(i2.pos_);
688 int y2 = c.yo() + c.descent();
689 pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
691 std::vector<MathInset::idx_type> indices
692 = i1.par_->idxBetween(i1.idx_, i2.idx_);
693 for (unsigned i = 0; i < indices.size(); ++i) {
694 MathXArray & c = i1.xcell(indices[i]);
696 int y1 = c.yo() - c.ascent();
697 int x2 = c.xo() + c.width();
698 int y2 = c.yo() + c.descent();
699 pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
704 // draw anchor if different from selection boundary
705 MathCursorPos anc = Anchor_.back();
706 if (anc != i1 && anc != i2) {
707 MathXArray & c = anc.xcell();
708 int x = c.xo() + c.pos2x(anc.pos_);
709 int y1 = c.yo() - c.ascent();
710 int y2 = c.yo() + c.descent();
711 pain.line(x, y1, x, y2, LColor::math);
717 void MathCursor::handleFont(MathTextCodes t)
723 getSelection(i1, i2);
724 if (i1.idx_ == i2.idx_) {
725 MathArray & ar = i1.cell();
726 for (MathInset::pos_type pos = i1.pos_; pos != i2.pos_; ++pos)
727 ar.at(pos)->handleFont(t);
730 lastcode_ = (lastcode_ == t) ? LM_TC_VAR : t;
734 void MathCursor::handleDelim(string const & l, string const & r)
736 handleNest(new MathDelimInset(l, r));
740 void MathCursor::handleNest(MathInset * p)
744 p->cell(0) = theSelection.glue();
746 insert(MathAtom(p)); // this invalidates p!
747 pushRight(prevAtom());
751 void MathCursor::getPos(int & x, int & y)
754 #warning This should probably take cellXOffset and cellYOffset into account
756 x = xarray().xo() + xarray().pos2x(pos());
761 MathInset * MathCursor::par() const
763 return cursor().par_;
767 InsetFormulaBase * MathCursor::formula()
773 MathCursor::idx_type MathCursor::idx() const
775 return cursor().idx_;
779 MathCursor::idx_type & MathCursor::idx()
781 return cursor().idx_;
785 MathCursor::pos_type MathCursor::pos() const
787 return cursor().pos_;
791 MathCursor::pos_type & MathCursor::pos()
793 return cursor().pos_;
797 bool MathCursor::inMacroMode() const
799 return macroNamePos() != -1;
803 bool MathCursor::selection() const
809 MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const
811 for (int i = Cursor_.size() - 1; i >= 0; --i) {
812 MathGridInset * p = Cursor_[i].par_->asGridInset();
814 idx = Cursor_[i].idx_;
822 void MathCursor::pullArg(bool goright)
825 MathArray a = array();
827 MathScriptInset const * p = par()->asScriptInset();
829 // special handling for scripts
830 const bool up = p->hasUp();
832 MathScriptInset * q = nextAtom()->asScriptInset();
836 array().insert(pos(), a);
842 array().insert(pos(), a);
849 void MathCursor::normalize() const
852 #warning This is evil!
854 MathCursor * it = const_cast<MathCursor *>(this);
856 if (idx() >= par()->nargs()) {
857 lyxerr << "this should not really happen - 1: "
858 << idx() << " " << par()->nargs() << "\n";
861 it->idx() = min(idx(), par()->nargs() - 1);
863 if (pos() > size()) {
864 lyxerr << "this should not really happen - 2: "
865 << pos() << " " << size() << " in idx: " << it->idx()
867 WriteStream wi(lyxerr, false);
868 it->par()->write(wi);
872 it->pos() = min(pos(), size());
876 MathCursor::size_type MathCursor::size() const
878 return array().size();
882 MathCursor::col_type MathCursor::hullCol() const
884 return Cursor_[0].par_->asGridInset()->col(Cursor_[0].idx_);
888 MathCursor::row_type MathCursor::hullRow() const
890 return Cursor_[0].par_->asGridInset()->row(Cursor_[0].idx_);
894 bool MathCursor::hasPrevAtom() const
900 bool MathCursor::hasNextAtom() const
902 return pos() < size();
906 MathAtom const & MathCursor::prevAtom() const
908 lyx::Assert(pos() > 0);
909 return array().at(pos() - 1);
913 MathAtom & MathCursor::prevAtom()
915 lyx::Assert(pos() > 0);
916 return array().at(pos() - 1);
920 MathAtom const & MathCursor::nextAtom() const
922 lyx::Assert(pos() < size());
923 return array().at(pos());
927 MathAtom & MathCursor::nextAtom()
929 lyx::Assert(pos() < size());
930 return array().at(pos());
934 MathArray & MathCursor::array() const
936 static MathArray dummy;
938 if (idx() >= par()->nargs()) {
939 lyxerr << "############ idx_ " << idx() << " not valid\n";
943 if (Cursor_.size() == 0) {
944 lyxerr << "############ Cursor_.size() == 0 not valid\n";
948 return cursor().cell();
952 MathXArray & MathCursor::xarray() const
954 static MathXArray dummy;
956 if (Cursor_.size() == 0) {
957 lyxerr << "############ Cursor_.size() == 0 not valid\n";
961 return cursor().xcell();
965 void MathCursor::idxNext()
967 par()->idxNext(idx(), pos());
971 void MathCursor::idxPrev()
973 par()->idxPrev(idx(), pos());
977 void MathCursor::splitCell()
979 if (idx() + 1 == par()->nargs())
981 MathArray ar = array();
983 array().erase(pos(), size());
986 array().insert(0, ar);
990 void MathCursor::breakLine()
996 MathHullInset * p = formula()->par()->asHullInset();
1000 if (p->getType() == LM_OT_SIMPLE || p->getType() == LM_OT_EQUATION) {
1001 p->mutate(LM_OT_EQNARRAY);
1005 p->addRow(hullRow());
1008 const row_type r = hullRow();
1009 for (col_type c = hullCol() + 1; c < p->ncols(); ++c)
1010 p->cell(p->index(r, c)).swap(p->cell(p->index(r + 1, c)));
1014 p->cell(idx()).swap(p->cell(idx() + p->ncols() - 1));
1019 //void MathCursor::readLine(MathArray & ar) const
1021 // idx_type base = row() * par()->ncols();
1022 // for (idx_type off = 0; off < par()->ncols(); ++off)
1023 // ar.push_back(par()->cell(base + off));
1027 char MathCursor::valign() const
1030 MathGridInset * p = enclosingGrid(idx);
1031 return p ? p->valign() : '\0';
1035 char MathCursor::halign() const
1038 MathGridInset * p = enclosingGrid(idx);
1039 return p ? p->halign(idx % p->ncols()) : '\0';
1043 void MathCursor::getSelection(MathCursorPos & i1, MathCursorPos & i2) const
1045 MathCursorPos anc = normalAnchor();
1046 if (anc < cursor()) {
1056 MathCursorPos & MathCursor::cursor()
1058 lyx::Assert(Cursor_.size());
1059 return Cursor_.back();
1063 MathCursorPos const & MathCursor::cursor() const
1065 lyx::Assert(Cursor_.size());
1066 return Cursor_.back();
1070 bool MathCursor::goUpDown(bool up)
1072 int xlow, xhigh, ylow, yhigh;
1077 // try current cell first
1078 xarray().boundingBox(xlow, xhigh, ylow, yhigh);
1083 if (bruteFind(xo, yo, xlow, xhigh, ylow, yhigh))
1086 // try to find an inset that knows better then we
1088 // we found a cell that think something "below" us.
1090 if (par()->idxUp(idx()))
1093 if (par()->idxDown(idx()))
1098 // no such inset found, just take something "above"
1103 up ? formula()->ylow() : yo + 4,
1104 up ? yo - 4 : formula()->yhigh()
1108 xarray().boundingBox(xlow, xhigh, ylow, yhigh);
1109 bruteFind(xo, yo, xlow, xhigh, ylow, yhigh);
1114 bool MathCursor::bruteFind(int x, int y, int xlow, int xhigh, int ylow, int yhigh)
1116 cursor_type best_cursor;
1117 double best_dist = 1e10;
1119 MathIterator it = ibegin(formula()->par().nucleus());
1120 MathIterator et = iend(formula()->par().nucleus());
1121 for ( ; it != et; ++it) {
1122 // avoid invalid nesting hen selecting
1123 if (selection_ && !positionable(it.cursor(), Anchor_))
1125 int xo = it.position().xpos();
1126 int yo = it.position().ypos();
1127 if (xlow - 2 <= xo && xo <= xhigh + 2 &&
1128 ylow - 2 <= yo && yo <= yhigh + 2)
1130 double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
1131 if (d < best_dist) {
1133 best_cursor = it.cursor();
1137 if (best_dist < 1e10)
1138 Cursor_ = best_cursor;
1139 return best_dist < 1e10;
1143 bool MathCursor::idxLeft()
1145 return par()->idxLeft(idx(), pos());
1149 bool MathCursor::idxRight()
1151 return par()->idxRight(idx(), pos());
1155 bool MathCursor::interpret(string const & s)
1157 //lyxerr << "interpret 1: '" << s << "'\n";
1162 return interpret(s[0]);
1164 //lyxerr << "char: '" << s[0] << "' int: " << int(s[0]) << endl;
1165 //owner_->getIntl()->getTrans().TranslateAndInsert(s[0], lt);
1166 //lyxerr << "trans: '" << s[0] << "' int: " << int(s[0]) << endl;
1168 if (s.size() >= 5 && s.substr(0, 5) == "cases") {
1170 istringstream is(s.substr(5).c_str());
1172 n = std::max(1u, n);
1173 niceInsert(MathAtom(new MathCasesInset(n)));
1177 if (s.size() >= 6 && s.substr(0, 6) == "matrix") {
1182 istringstream is(s.substr(6).c_str());
1183 is >> m >> n >> v_align >> h_align;
1184 m = std::max(1u, m);
1185 n = std::max(1u, n);
1187 niceInsert(MathAtom(new MathArrayInset(m, n, v_align[0], h_align)));
1191 if (s.size() >= 7 && s.substr(0, 7) == "replace") {
1193 istringstream is(s.substr(7).c_str());
1196 mathed_parse_cell(rep.from, from);
1197 mathed_parse_cell(rep.to, to);
1198 lyxerr << "replacing '" << from << "' with '" << to << "'\n";
1199 par()->replace(rep);
1203 if (s == "\\over" || s == "\\choose" || s == "\\atop") {
1204 MathArray ar = array();
1205 MathAtom t = createMathInset(s.substr(1));
1206 t->asNestInset()->cell(0).swap(array());
1214 latexkeys const * l = in_word_set(s.substr(1));
1215 if (l && (l->token == LM_TK_FONT || l->token == LM_TK_OLDFONT)) {
1216 lastcode_ = static_cast<MathTextCodes>(l->id);
1220 niceInsert(createMathInset(s.substr(1)));
1225 bool MathCursor::interpret(char c)
1227 //lyxerr << "interpret 2: '" << c << "'\n";
1228 if (c == '^' || c == '_') {
1230 const bool up = (c == '^');
1232 if (hasPrevAtom() && prevAtom()->asScriptInset()) {
1233 prevAtom()->asScriptInset()->ensure(up);
1234 pushRight(prevAtom());
1237 } else if (hasNextAtom() && nextAtom()->asScriptInset()) {
1238 nextAtom()->asScriptInset()->ensure(up);
1239 pushLeft(nextAtom());
1243 plainInsert(MathAtom(new MathScriptInset(up)));
1244 prevAtom()->asScriptInset()->ensure(up);
1245 pushRight(prevAtom());
1256 if (inMacroMode()) {
1257 string name = macroName();
1259 if (name == "\\" && c == '#') {
1260 insert(c, LM_TC_TEX);
1264 if (name == "\\" && c == '\\') {
1266 interpret("\\backslash");
1270 if (name == "\\#" && '1' <= c && c <= '9') {
1271 insert(c, LM_TC_TEX);
1277 insert(c, LM_TC_TEX);
1282 insert(c, LM_TC_TEX);
1294 if (lastcode_ == LM_TC_TEXTRM) {
1295 // suppress direct insertion of to spaces in a row
1296 // the still allows typing '<space>a<space>' and deleting the 'a', but
1297 // it is better than nothing
1298 if (c == ' ' && hasPrevAtom() && prevAtom()->getChar() == ' ')
1300 insert(c, LM_TC_TEXTRM);
1305 if (hasPrevAtom() && prevAtom()->asSpaceInset()) {
1306 prevAtom()->asSpaceInset()->incSpace();
1310 if (mathcursor->popRight())
1313 // if are at the very end, leave the formula
1314 return pos() != size();
1318 if (strchr("{}", c)) {
1319 insert(c, LM_TC_TEX);
1325 niceInsert(MathAtom(new MathBraceInset));
1333 if (strchr("#$%", c)) {
1334 insert(MathAtom(new MathSpecialCharInset(c)));
1335 lastcode_ = LM_TC_VAR;
1339 if (isalpha(c) && lastcode_ == LM_TC_GREEK) {
1340 insert(c, LM_TC_VAR);
1344 if (isalpha(c) && lastcode_ == LM_TC_GREEK1) {
1345 insert(c, LM_TC_VAR);
1346 lastcode_ = LM_TC_VAR;
1351 insert(c, LM_TC_TEX);
1352 //bv->owner()->message(_("TeX mode"));
1356 // no special circumstances, so insert the character without any fuss
1357 insert(c, lastcode_);
1358 lastcode_ = LM_TC_MIN;
1364 MathCursorPos MathCursor::normalAnchor() const
1366 if (Anchor_.size() < Cursor_.size()) {
1368 lyxerr << "unusual Anchor size\n";
1371 //lyx::Assert(Anchor_.size() >= Cursor_.size());
1372 // use Anchor on the same level as Cursor
1373 MathCursorPos normal = Anchor_[Cursor_.size() - 1];
1374 if (Cursor_.size() < Anchor_.size() && !(normal < cursor())) {
1375 // anchor is behind cursor -> move anchor behind the inset
1382 void MathCursor::stripFromLastEqualSign()
1384 // find position of last '=' in the array
1385 MathArray & ar = cursor().cell();
1386 MathArray::const_iterator et = ar.end();
1387 for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
1388 if ((*it)->getChar() == '=')
1391 // delete everything behind this position
1392 ar.erase(et - ar.begin(), ar.size());