From b64a7173bccc61a9249bda82413da29c39f6e639 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 6 May 2008 06:41:08 +0000 Subject: [PATCH] * InsetMathHull: - fix rest of bug 518. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24627 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathHull.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 98b3a99cfb..0f5fbb3989 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -684,15 +684,19 @@ void InsetMathHull::addRow(row_type row) return; bool numbered = numberedType(); + docstring lab; if (type_ == hullMultline) { - if (row + 1 == nrows()) + if (row + 1 == nrows()) { nonum_[row] = true; - else + lab = label(row); + } else numbered = false; } nonum_.insert(nonum_.begin() + row + 1, !numbered); label_.insert(label_.begin() + row + 1, dummy_pointer); + if (!lab.empty()) + label(row + 1, lab); InsetMathGrid::addRow(row); } @@ -720,6 +724,14 @@ void InsetMathHull::delRow(row_type row) { if (nrows() <= 1 || !rowChangeOK()) return; + if (row + 1 == nrows() && type_ == hullMultline) { + bool const b = nonum_[row - 1]; + nonum_[row - 1] = nonum_[row]; + nonum_[row] = b; + swap(label_[row - 1], label_[row]); + InsetMathGrid::delRow(row); + return; + } InsetMathGrid::delRow(row); // The last dummy row has no number info nor a label. // Test nrows() + 1 because we have already erased the row. @@ -1302,8 +1314,10 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_MATH_NUMBER_LINE_TOGGLE: { // FIXME: what is the right test, this or the one of // LABEL_INSERT? - status.enabled(display()); + bool const enable = (type_ == hullMultline) ? + (nrows() - 1 == cur.row()) : display(); row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row(); + status.enabled(enable); status.setOnOff(numbered(r)); return true; } -- 2.39.2