backport rev. 23610:

URL: http://www.lyx.org/trac/changeset/23610
Log:
* 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/branches/BRANCH_1_5_X@23685 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-03-12 15:06:07 +00:00
parent 33d93b32db
commit a965ea56a1
2 changed files with 21 additions and 1 deletions

View File

@ -29,6 +29,7 @@
#include "Text.h"
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "CutAndPaste.h"
@ -442,7 +443,11 @@ docstring InsetMathHull::label(row_type row) const
void InsetMathHull::label(row_type row, docstring const & label)
{
//lyxerr << "setting label '" << label << "' for row " << row << endl;
label_[row] = label;
if (label.empty()) {
nonum_[row] = true;
label_[row].clear();
} else
label_[row] = label;
}
@ -1119,6 +1124,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()) {
recordUndoInset(cur);
label(row(cur.idx()), docstring());
} else {
InsetMathGrid::doDispatch(cur, cmd);
return;
}
break;
case LFUN_INSET_INSERT: {
//lyxerr << "arg: " << to_utf8(cmd.argument()) << endl;
std::string const name = cmd.getArg(0);

View File

@ -80,6 +80,8 @@ What's new
* USER INTERFACE:
- Allow deleting a label in a formula with the delete key (bug 2556).
- Allow to enter starred math commands such as \tag* (bug 4584).
- Load amsmath when \tag or \tag* is used (bug 4586).