mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Position better the cursor after math-display
When the cursor had idx > 0 (since math-display does merging anyways), reset cursor to the start of the inset. This looks less strange than setting it at the end. Now at least the basic case of a displayed equation with cursor somewhere at top-level is handled correctly. The math-display lfun operates at top level in the math inset. Therefore, when the cursor is in an inner inset, it will after the lfun be moved at top level. Unfortunately, there is no way that I know f to detect this in Inset::doDispatch. Even if we could, as things stand, it is difficult to keep the cursor in the inner inset, especially if the inner inset moves : this happens for example when moving from eqnarray to inline maths. Therefore this fix is the best I can think of now. Fixes part of bug #9664.
This commit is contained in:
parent
2a7deb802a
commit
7d018853fc
@ -1647,9 +1647,15 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_MATH_DISPLAY: {
|
case LFUN_MATH_DISPLAY: {
|
||||||
cur.recordUndoInset();
|
cur.recordUndoInset();
|
||||||
mutate(type_ == hullSimple ? hullEquation : hullSimple);
|
mutate(type_ == hullSimple ? hullEquation : hullSimple);
|
||||||
|
// if the cursor is in a cell that got merged, move it to
|
||||||
|
// start of the hull inset.
|
||||||
|
if (cur.idx() > 0) {
|
||||||
cur.idx() = 0;
|
cur.idx() = 0;
|
||||||
|
cur.pos() = 0;
|
||||||
|
}
|
||||||
|
if (cur.pos() > cur.lastpos())
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
//cur.dispatched(FINISHED);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user