"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
This commit is contained in:
Stefan Schimanski 2008-03-09 23:43:05 +00:00
parent 635b2c1cc3
commit 9a9e94bca2

View File

@ -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.