if (updateNeeded)
forceBufferUpdate();
}
- return false;
+ return valid_destination;
}
// with and without selection are handled differently
/// return true if fullscreen update is needed
bool down();
/// move up/down in a text inset, called for LFUN_UP/DOWN,
- /// return true if successful, updateNeeded set to true if fullscreen
- /// update is needed, otherwise it's not touched
+ /// return true if the cursor has moved or can move, updateNeeded
+ /// set to true if fullscreen update is needed, otherwise it's not
+ /// touched
bool upDownInText(bool up, bool & updateNeeded);
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
/// return true if successful
LFUN_SPELLING_ADD_LOCAL, // jspitzm 20210306
// 390
LFUN_SPELLING_REMOVE_LOCAL, // jspitzm 20210307
+ LFUN_FINISHED_DOWN, // lasgouttes 20210629
+ LFUN_FINISHED_UP, // lasgouttes 20210629
LFUN_LASTACTION // end of the table
};
*/
{ LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_FINISHED_UP
+ * \li Action: Moves the cursor out of the current slice, going up.
+ * \li Notion: See also #LFUN_FINISHED_DOWN.
+ * \endvar
+ */
+ { LFUN_FINISHED_UP, "", ReadOnly, Hidden },
+
+/*!
+ * \var lyx::FuncCode lyx::LFUN_FINISHED_DOWN
+ * \li Action: Moves the cursor out of the current slice, going down.
+ * \li Notion: See also #LFUN_FINISHED_DOWN.
+ * \endvar
+ */
+ { LFUN_FINISHED_DOWN, "", ReadOnly, Hidden },
+
/*!
* \var lyx::FuncCode lyx::LFUN_FLEX_INSERT
* \li Action: Inserts CharStyle, Custom inset or XML short element.
case LFUN_UP:
case LFUN_DOWN: {
// stop/start the selection
- bool select = cmd.action() == LFUN_DOWN_SELECT ||
- cmd.action() == LFUN_UP_SELECT;
-
+ bool const select = cmd.action() == LFUN_DOWN_SELECT
+ || cmd.action() == LFUN_UP_SELECT;
// move cursor up/down
- bool up = cmd.action() == LFUN_UP_SELECT || cmd.action() == LFUN_UP;
- bool const atFirstOrLastRow = cur.atFirstOrLastRow(up);
+ bool const up = cmd.action() == LFUN_UP_SELECT || cmd.action() == LFUN_UP;
- if (!atFirstOrLastRow) {
+ if (!cur.atFirstOrLastRow(up)) {
needsUpdate |= cur.selHandle(select);
cur.upDownInText(up, needsUpdate);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
cur.forceBufferUpdate();
break;
}
+ needsUpdate |= cur.selHandle(select);
+ bool const can_move = cur.upDownInText(up, needsUpdate);
+ // if the cursor can be moved up or down at an upper level,
+ // delegate the dispatch to next level. Otherwise, we are
+ // done.
+ if (can_move) {
+ cmd = FuncRequest(up ? LFUN_FINISHED_UP : LFUN_FINISHED_DOWN);
+ cur.undispatched();
+ }
+ }
- // if the cursor cannot be moved up or down do not remove
- // the selection right now, but wait for the next dispatch.
- if (select)
- needsUpdate |= cur.selHandle(select);
+ break;
+ }
+
+ case LFUN_FINISHED_UP:
+ case LFUN_FINISHED_DOWN: {
+ // move cursor up/down
+ bool const up = cmd.action() == LFUN_FINISHED_UP;
+
+ if (!cur.atFirstOrLastRow(up)) {
cur.upDownInText(up, needsUpdate);
- cur.undispatched();
+ needsUpdate |= cur.beforeDispatchCursor().inMathed();
+ } else {
+ bool const can_move = cur.upDownInText(up, needsUpdate);
+ // if the cursor can be moved up or down and we are not
+ // moving cusor at top level, wait for the next dispatch.
+ // Otherwise, we are done.
+ if (can_move)
+ cur.undispatched();
}
break;