]> git.lyx.org Git - features.git/commitdiff
Fix tabular cursor movement:
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 19 Nov 2008 01:02:48 +0000 (01:02 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 19 Nov 2008 01:02:48 +0000 (01:02 +0000)
- 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

src/insets/InsetTabular.cpp

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