mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Revert "Always remove selection after cursor up/down"
This reverts commit 008a0825e8
.
This commit was part of bug #12310. The goal was to remove the
selection when using "up" at the start of selection (so that the
cursor cannot move). Unfortunately, it creates navigation issues for
insets inside tabulars.
Since the fix was minor, the safest decision is to revert.
The part of ticket #12310 that resets selection with
char-forwars/backward when moving is not possible still works.
Fixes bug #12593.
This commit is contained in:
parent
0008604b20
commit
a559616cbd
@ -2217,7 +2217,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
if (updateNeeded)
|
if (updateNeeded)
|
||||||
forceBufferUpdate();
|
forceBufferUpdate();
|
||||||
}
|
}
|
||||||
return valid_destination;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// with and without selection are handled differently
|
// with and without selection are handled differently
|
||||||
|
@ -496,9 +496,8 @@ public:
|
|||||||
/// return true if fullscreen update is needed
|
/// return true if fullscreen update is needed
|
||||||
bool down();
|
bool down();
|
||||||
/// move up/down in a text inset, called for LFUN_UP/DOWN,
|
/// move up/down in a text inset, called for LFUN_UP/DOWN,
|
||||||
/// return true if the cursor has moved or can move, updateNeeded
|
/// return true if successful, updateNeeded set to true if fullscreen
|
||||||
/// set to true if fullscreen update is needed, otherwise it's not
|
/// update is needed, otherwise it's not touched
|
||||||
/// touched
|
|
||||||
bool upDownInText(bool up, bool & updateNeeded);
|
bool upDownInText(bool up, bool & updateNeeded);
|
||||||
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
|
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
|
||||||
/// return true if successful
|
/// return true if successful
|
||||||
|
@ -500,8 +500,6 @@ enum FuncCode
|
|||||||
LFUN_SPELLING_ADD_LOCAL, // jspitzm 20210306
|
LFUN_SPELLING_ADD_LOCAL, // jspitzm 20210306
|
||||||
// 390
|
// 390
|
||||||
LFUN_SPELLING_REMOVE_LOCAL, // jspitzm 20210307
|
LFUN_SPELLING_REMOVE_LOCAL, // jspitzm 20210307
|
||||||
LFUN_FINISHED_DOWN, // lasgouttes 20210629
|
|
||||||
LFUN_FINISHED_UP, // lasgouttes 20210629
|
|
||||||
LFUN_BRANCH_SYNC_ALL, // sanda 20220415
|
LFUN_BRANCH_SYNC_ALL, // sanda 20220415
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
@ -1677,22 +1677,6 @@ void LyXAction::init()
|
|||||||
*/
|
*/
|
||||||
{ LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
|
{ 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
|
* \var lyx::FuncCode lyx::LFUN_FLEX_INSERT
|
||||||
* \li Action: Inserts CharStyle, Custom inset or XML short element.
|
* \li Action: Inserts CharStyle, Custom inset or XML short element.
|
||||||
|
@ -914,12 +914,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_UP:
|
case LFUN_UP:
|
||||||
case LFUN_DOWN: {
|
case LFUN_DOWN: {
|
||||||
// stop/start the selection
|
// stop/start the selection
|
||||||
bool const select = cmd.action() == LFUN_DOWN_SELECT
|
bool select = cmd.action() == LFUN_DOWN_SELECT ||
|
||||||
|| cmd.action() == LFUN_UP_SELECT;
|
cmd.action() == LFUN_UP_SELECT;
|
||||||
// move cursor up/down
|
|
||||||
bool const up = cmd.action() == LFUN_UP_SELECT || cmd.action() == LFUN_UP;
|
|
||||||
|
|
||||||
if (!cur.atFirstOrLastRow(up)) {
|
// move cursor up/down
|
||||||
|
bool up = cmd.action() == LFUN_UP_SELECT || cmd.action() == LFUN_UP;
|
||||||
|
bool const atFirstOrLastRow = cur.atFirstOrLastRow(up);
|
||||||
|
|
||||||
|
if (!atFirstOrLastRow) {
|
||||||
needsUpdate |= cur.selHandle(select);
|
needsUpdate |= cur.selHandle(select);
|
||||||
cur.upDownInText(up, needsUpdate);
|
cur.upDownInText(up, needsUpdate);
|
||||||
needsUpdate |= cur.beforeDispatchCursor().inMathed();
|
needsUpdate |= cur.beforeDispatchCursor().inMathed();
|
||||||
@ -935,34 +937,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
cur.forceBufferUpdate();
|
cur.forceBufferUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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.upDownInText(up, needsUpdate);
|
||||||
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();
|
cur.undispatched();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user