backport revision 26668. I believe a have tested this sufficently now.

> Author: younes
> Date: Wed Oct  1 10:18:57 2008
> New Revision: 26668

> URL: http://www.lyx.org/trac/changeset/26668
> Log:
> 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/branches/BRANCH_1_5_X@26809 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-10-08 09:01:25 +00:00
parent 1be64381ce
commit dd94d72560
2 changed files with 43 additions and 0 deletions

View File

@ -3235,6 +3235,10 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
setCursorFromCoordinates(cur, cmd.x, cmd.y);
bvcur.setCursor(cur);
bvcur.selection() = true;
if (tablemode(bvcur)) {
bvcur.pit() = bvcur.lastpit();
bvcur.pos() = bvcur.lastpos();
}
} else
cur.undispatched();
}
@ -3301,6 +3305,11 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
cur.undispatched();
}
if (tablemode(cur)) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
return;
}
break;
case LFUN_UP_SELECT:
@ -3324,6 +3333,11 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cmd = FuncRequest(LFUN_UP);
cur.undispatched();
}
if (tablemode(cur)) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
return;
}
break;
// case LFUN_SCREEN_DOWN: {
@ -3415,6 +3429,14 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cell(cur.idx())->dispatch(cur, cmd);
break;
case LFUN_SELF_INSERT:
if (tablemode(cur)) {
recordUndoInset(cur, Undo::DELETE);
cutSelection(cur);
}
cell(cur.idx())->dispatch(cur, cmd);
break;
case LFUN_COPY:
if (!cur.selection())
break;
@ -4003,6 +4025,16 @@ void InsetTabular::moveNextCell(Cursor & cur)
return;
++cur.idx();
}
cur.boundary(false);
if (tablemode(cur)) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
resetPos(cur);
return;
}
cur.pit() = 0;
cur.pos() = 0;
resetPos(cur);
@ -4028,6 +4060,14 @@ void InsetTabular::movePrevCell(Cursor & cur)
return;
--cur.idx();
}
if (tablemode(cur)) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
resetPos(cur);
return;
}
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();

View File

@ -123,6 +123,9 @@ What's new
- Fix a crash on some systems when using the math panel (bug 5189).
- Fix the input behaviour when multiple cells of a table were selected,
including a possible assertion (bug 5225).
- Empty lines are correctly removed when the cursor moves due to the
"cursor follows scrollbar" feature (bug 5065).