From: André Pönitz Date: Mon, 23 Jul 2001 14:21:34 +0000 (+0000) Subject: keep empty super/subscript a bit longer X-Git-Tag: 1.6.10~21029 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b321afd875d9a4df36ae08124a510c47eaae57c6;p=features.git keep empty super/subscript a bit longer git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2309 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 47b464380b..a8b59de0fa 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -2,6 +2,8 @@ * math_cursor.C: fix "pullArg" behaviour + * math_cursor.C: keep empty super/subscript a bit longer + 2001-07-22 Jean-Marc Lasgouttes * formula.C (insetAllowed): allow insertion of label diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index e3122101f4..caddb54500 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -54,7 +54,6 @@ using std::min; using std::max; using std::isalnum; -#define RECTANGULAR_SELECT 1 namespace { @@ -90,37 +89,16 @@ struct Selection if (i1.idx_ == i2.idx_) { i1.cell().erase(i1.pos_, i2.pos_); } else { -#ifdef RECTANGULAR_SELECT std::vector indices = i1.par_->idxBetween(i1.idx_, i2.idx_); for (unsigned i = 0; i < indices.size(); ++i) i1.cell(indices[i]).erase(); -#else - i1.cell().erase(i1.pos_, i1.cell().size()); - for (int i = i1.idx_ + 1; i < i2.idx_; ++i) - i1.cell(i).erase(); - i2.cell().erase(0, i2.pos_); - - int from = i1.cell().size() ? i1.idx_ + 1 : i1.idx_; - int to = i2.cell().size() ? i2.idx_ : i2.idx_ + 1; - i1.par_->idxDeleteRange(from, to); -#endif } cursor.cursor() = i1; } void paste(MathCursor & cursor) const { -#ifdef RECTANGULAR_SELECT cursor.cursor().cell().push_back(glue()); -#else - unsigned na = cursor.cursor().par_->nargs(); - unsigned idx = cursor.cursor().idx_; - unsigned end = std::min(idx + data_.size(), na); - for (int i = 0; i < end - idx; ++i) - cursor.cursor().cell(idx + i).push_back(data_[i]); - for (unsigned i = end - idx; i < data_.size(); ++i) - cursor.cursor().cell(end - 1).push_back(data_[i]); -#endif } // glues selection to one cell @@ -486,9 +464,6 @@ void MathCursor::Delete() return; } - if (cursor().pos_ < array().size()) - array().erase(cursor().pos_); - // delete empty cells if necessary if (cursor().pos_ == 0 && array().size() == 0) { bool popit; @@ -496,8 +471,12 @@ void MathCursor::Delete() cursor().par_->idxDelete(cursor().idx_, popit, removeit); if (popit && pop() && removeit) Delete(); + return; } + if (cursor().pos_ < array().size()) + array().erase(cursor().pos_); + dump("Delete 2"); } @@ -898,7 +877,6 @@ void MathCursor::drawSelection(Painter & pain) const pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection); } else { -#if RECTANGULAR_SELECT std::vector indices = i1.par_->idxBetween(i1.idx_, i2.idx_); for (unsigned i = 0; i < indices.size(); ++i) { MathXArray & c = i1.xcell(indices[i]); @@ -908,31 +886,6 @@ void MathCursor::drawSelection(Painter & pain) const int y2 = c.yo() + c.descent(); pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection); } -#else - // leftmost cell - MathXArray & c = i1.xcell(); - int x1 = c.xo() + c.pos2x(i1.pos_); - int y1 = c.yo() - c.ascent(); - int x2 = c.xo() + c.width(); - int y2 = c.yo() + c.descent(); - pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection); - // middle cells - for (int idx = i1.idx_ + 1; idx < i2.idx_; ++idx) { - MathXArray & c = i1.xcell(idx); - int x1 = c.xo(); - int y1 = c.yo() - c.ascent(); - int x2 = c.xo() + c.width(); - int y2 = c.yo() + c.descent(); - pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection); - } - // rightmost cell - MathXArray & cr = i2.xcell(); - x1 = cr.xo(); - y1 = cr.yo() - cr.ascent(); - x2 = cr.xo() + cr.pos2x(i2.pos_); - y2 = cr.yo() + cr.descent(); - pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection); -#endif } }