The second chunk is a fix to #9291 "Cannot exit table when selecting with keyboard to right or left". The problem was simply that the default status for the cursor in the call to *::doDispatch is dispatched... (btw, there are many cur.dispatched() statements there that may be superfluous).
The first chunk just avoids forgetting the selection on reenter. Comments? A/
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 2a9c7e6..de9f862 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3875,7 +3875,7 @@ void InsetTabular::edit(Cursor & cur, bool front, EntryDirection) { //lyxerr << "InsetTabular::edit: " << this << endl; cur.finishUndo(); - cur.setSelection(false); + //cur.setSelection(false); cur.push(*this); if (front) { if (isRightToLeft(cur)) @@ -4155,9 +4155,10 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd) else movePrevCell(cur, entry_from); // if we're exiting the table, call the appropriate FINISHED lfun - if (sl == cur.top()) + if (sl == cur.top()) { cmd = FuncRequest(finish_lfun); - else + cur.undispatched(); + } else cur.dispatched(); cur.screenUpdateFlags(Update::Force | Update::FitCursor);