From: Stefan Schimanski Date: Sun, 9 Mar 2008 23:43:05 +0000 (+0000) Subject: * fix for http://bugzilla.lyx.org/show_bug.cgi?id=2556 X-Git-Tag: 1.6.10~5748 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9a9e94bca24173e93b257cc179c37d53754e9922;p=features.git * fix for http://bugzilla.lyx.org/show_bug.cgi?id=2556 "not possible to delete a label of a formula": Press forward delete at the end of a row and the label is deleted. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23610 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 63065c2fb9..47615db07d 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -26,6 +26,7 @@ #include "InsetMathRef.h" #include "Buffer.h" +#include "buffer_funcs.h" #include "BufferParams.h" #include "BufferView.h" #include "CutAndPaste.h" @@ -492,7 +493,12 @@ void InsetMathHull::label(row_type row, docstring const & label) { //lyxerr << "setting label '" << label << "' for row " << row << endl; if (label_[row]) { - label_[row]->updateCommand(label); + if (label.empty()) { + delete label_[row]; + nonum_[row] = true; + label_[row] = dummy_pointer; + } else + label_[row]->updateCommand(label); return; } InsetCommandParams p(LABEL_CODE); @@ -1175,6 +1181,19 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) break; } + case LFUN_WORD_DELETE_FORWARD: + case LFUN_CHAR_DELETE_FORWARD: + if (col(cur.idx()) + 1 == ncols() + && cur.pos() == cur.lastpos() + && !label(row(cur.idx())).empty()) { + cur.recordUndoInset(); + label(row(cur.idx()), docstring()); + } else { + InsetMathGrid::doDispatch(cur, cmd); + return; + } + break; + case LFUN_INSET_INSERT: { //lyxerr << "arg: " << to_utf8(cmd.argument()) << endl; // FIXME: this should be cleaned up to use InsetLabel methods directly.