mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Only allow the cursor to be in lastpos for macros as editing in macro-mode is only possible at lastpos.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30396 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ebe9b42279
commit
ebe7913a47
@ -1862,6 +1862,9 @@ bool InsetMathNest::cursorMathForward(Cursor & cur)
|
|||||||
if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
|
if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
|
||||||
cur.pushBackward(*cur.nextAtom().nucleus());
|
cur.pushBackward(*cur.nextAtom().nucleus());
|
||||||
cur.inset().idxFirst(cur);
|
cur.inset().idxFirst(cur);
|
||||||
|
if (cur.inset().asInsetMath()->asMacro())
|
||||||
|
// editing macros is only possible at lastpos
|
||||||
|
cur.pos() = cur.lastpos();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cur.posForward() || idxForward(cur))
|
if (cur.posForward() || idxForward(cur))
|
||||||
@ -1883,11 +1886,15 @@ bool InsetMathNest::cursorMathBackward(Cursor & cur)
|
|||||||
cur.inset().idxLast(cur);
|
cur.inset().idxLast(cur);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
MathMacro const * macro = cur.inset().asInsetMath()->asMacro();
|
||||||
|
int s = cur.depth() - 2;
|
||||||
|
if (macro && s >= 0 && cur[s].inset().asInsetMath())
|
||||||
|
// editing macros is only possible at lastpos
|
||||||
|
return cur.popBackward();
|
||||||
if (cur.posBackward() || idxBackward(cur))
|
if (cur.posBackward() || idxBackward(cur))
|
||||||
return true;
|
return true;
|
||||||
// try to pop backwards --- but don't pop out of math! leave that to
|
// try to pop backwards --- but don't pop out of math! leave that to
|
||||||
// the FINISH lfuns
|
// the FINISH lfuns
|
||||||
int s = cur.depth() - 2;
|
|
||||||
if (s >= 0 && cur[s].inset().asInsetMath())
|
if (s >= 0 && cur[s].inset().asInsetMath())
|
||||||
return cur.popBackward();
|
return cur.popBackward();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user