Fix tabular cursor movement:

- allow repeated shift-up in a multi-line column,
- finish r27581 and r27567 :
    we have to call cur.selHandle ourselves now,
- do not dispatch to the cell in multicell selection.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27632 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2008-11-19 01:02:48 +00:00
parent 550f1d9ce8
commit d38cc523c6

View File

@ -3418,12 +3418,15 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_DOWN_SELECT: case LFUN_DOWN_SELECT:
case LFUN_DOWN: case LFUN_DOWN:
cell(cur.idx())->dispatch(cur, cmd); if (!(cur.selection() && cur.selIsMultiCell()))
cell(cur.idx())->dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision cur.dispatched(); // override the cell's decision
if (sl == cur.top()) if (sl == cur.top()) {
// if our Text didn't do anything to the cursor // if our Text didn't do anything to the cursor
// then we try to put the cursor into the cell below // then we try to put the cursor into the cell below
// setting also the right targetX. // setting also the right targetX.
cur.selHandle(cmd.action == LFUN_DOWN_SELECT);
if (tabular.cellRow(cur.idx()) != tabular.row_info.size() - 1) { if (tabular.cellRow(cur.idx()) != tabular.row_info.size() - 1) {
cur.idx() = tabular.cellBelow(cur.idx()); cur.idx() = tabular.cellBelow(cur.idx());
cur.pit() = 0; cur.pit() = 0;
@ -3431,6 +3434,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.bv().textMetrics(cell(cur.idx())->getText(0)); cur.bv().textMetrics(cell(cur.idx())->getText(0));
cur.pos() = tm.x2pos(cur.pit(), 0, cur.targetX()); cur.pos() = tm.x2pos(cur.pit(), 0, cur.targetX());
} }
}
if (sl == cur.top()) { if (sl == cur.top()) {
// we trick it to go to forward after leaving the // we trick it to go to forward after leaving the
// tabular. // tabular.
@ -3446,12 +3450,14 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_UP_SELECT: case LFUN_UP_SELECT:
case LFUN_UP: case LFUN_UP:
cell(cur.idx())->dispatch(cur, cmd); if (!(cur.selection() && cur.selIsMultiCell()))
cell(cur.idx())->dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision cur.dispatched(); // override the cell's decision
if (sl == cur.top()) if (sl == cur.top()) {
// if our Text didn't do anything to the cursor // if our Text didn't do anything to the cursor
// then we try to put the cursor into the cell above // then we try to put the cursor into the cell above
// setting also the right targetX. // setting also the right targetX.
cur.selHandle(cmd.action == LFUN_UP_SELECT);
if (tabular.cellRow(cur.idx()) != 0) { if (tabular.cellRow(cur.idx()) != 0) {
cur.idx() = tabular.cellAbove(cur.idx()); cur.idx() = tabular.cellAbove(cur.idx());
cur.pit() = cur.lastpit(); cur.pit() = cur.lastpit();
@ -3461,12 +3467,13 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
tm.parMetrics(cur.lastpit()); tm.parMetrics(cur.lastpit());
cur.pos() = tm.x2pos(cur.pit(), pm.rows().size()-1, cur.targetX()); cur.pos() = tm.x2pos(cur.pit(), pm.rows().size()-1, cur.targetX());
} }
}
if (sl == cur.top()) { if (sl == cur.top()) {
cmd = FuncRequest(LFUN_UP); cmd = FuncRequest(LFUN_UP);
cur.undispatched(); cur.undispatched();
} }
if (cur.selIsMultiCell()) { if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit(); cur.pit() = 0;
cur.pos() = cur.lastpos(); cur.pos() = cur.lastpos();
return; return;
} }