Modify the way multi-cell selection is done in tables:

* Always put the cursor at the end of the cell (this was set at the beginning with mouse selection).
* handle LFUN_SELF_INSERT in case of multi-cell selection -> the whole cell contents will be deleted.

This commit fixes http://bugzilla.lyx.org/show_bug.cgi?id=5225


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26668 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-10-01 08:18:57 +00:00
parent 1b47d2e5e2
commit 0ac664310a

View File

@ -3295,8 +3295,8 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
// if this is a multicell selection, we just set the cursor to
// the beginning of the cell's text.
if (bvcur.selIsMultiCell()) {
bvcur.pit() = 0;
bvcur.pos() = 0;
bvcur.pit() = bvcur.lastpit();
bvcur.pos() = bvcur.lastpos();
}
}
break;
@ -3409,6 +3409,11 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
cur.undispatched();
}
if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
return;
}
break;
case LFUN_UP_SELECT:
@ -3432,6 +3437,11 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cmd = FuncRequest(LFUN_UP);
cur.undispatched();
}
if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
return;
}
break;
// case LFUN_SCREEN_DOWN: {
@ -3513,6 +3523,14 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cell(cur.idx())->dispatch(cur, cmd);
break;
case LFUN_SELF_INSERT:
if (cur.selIsMultiCell()) {
cur.recordUndoInset(DELETE_UNDO);
cutSelection(cur);
}
cell(cur.idx())->dispatch(cur, cmd);
break;
case LFUN_CHAR_DELETE_BACKWARD:
case LFUN_CHAR_DELETE_FORWARD:
if (cur.selIsMultiCell()) {
@ -4126,9 +4144,18 @@ void InsetTabular::moveNextCell(Cursor & cur, EntryDirection entry_from)
return;
++cur.idx();
}
cur.boundary(false);
if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
resetPos(cur);
return;
}
cur.pit() = 0;
cur.pos() = 0;
cur.boundary(false);
// in visual mode, place cursor at extreme left or right
@ -4169,6 +4196,14 @@ void InsetTabular::movePrevCell(Cursor & cur, EntryDirection entry_from)
return;
--cur.idx();
}
if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
resetPos(cur);
return;
}
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();