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