From dd94d72560f66a452d9cf45e642bcde223057ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 8 Oct 2008 09:01:25 +0000 Subject: [PATCH] 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 --- src/insets/InsetTabular.cpp | 40 +++++++++++++++++++++++++++++++++++++ status.15x | 3 +++ 2 files changed, 43 insertions(+) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 82092abed6..d3a6d98f8e 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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(); diff --git a/status.15x b/status.15x index b70b3e2e89..cf87ef9f07 100644 --- a/status.15x +++ b/status.15x @@ -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).