fix cursor positioning in non-grid nestinsets, and selection enclosure

when inserting font or deco insets.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9784 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2005-04-06 19:01:55 +00:00
parent 719dc8c0b2
commit f4c0f6ec8b
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-04-06 Martin Vermeer <martin.vermeer@hut.fi>
* math_nestinset.C (doDispatch): fix cursor positioning in
non-grid nestinsets, and selection enclosure when inserting
font or deco insets.
2005-04-05 Martin Vermeer <martin.vermeer@hut.fi> 2005-04-05 Martin Vermeer <martin.vermeer@hut.fi>
* math_amsarrayinset.C: * math_amsarrayinset.C:

View File

@ -557,7 +557,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
cur.clearTargetX(); cur.clearTargetX();
if (cur.pos() != cur.lastpos()) { if (cur.pos() != cur.lastpos()) {
cur.pos() = cur.lastpos(); cur.pos() = cur.lastpos();
} else if (cur.col() != cur.lastcol()) { } else if (ncols() && (cur.col() != cur.lastcol())) {
cur.idx() = cur.idx() - cur.col() + cur.lastcol(); cur.idx() = cur.idx() - cur.col() + cur.lastcol();
cur.pos() = cur.lastpos(); cur.pos() = cur.lastpos();
} else if (cur.idx() != cur.lastidx()) { } else if (cur.idx() != cur.lastidx()) {
@ -795,10 +795,16 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
// FIXME: We probably should swap parts of "math-insert" and "self-insert" // FIXME: We probably should swap parts of "math-insert" and "self-insert"
// handling such that "self-insert" works on "arbitrary stuff" too, and // handling such that "self-insert" works on "arbitrary stuff" too, and
// math-insert only handles special math things like "matrix". // math-insert only handles special math things like "matrix".
case LFUN_INSERT_MATH: case LFUN_INSERT_MATH: {
recordUndo(cur, Undo::ATOMIC); recordUndo(cur, Undo::ATOMIC);
cur.niceInsert(cmd.argument); MathArray ar;
asArray(cmd.argument, ar);
if (ar.size() == 1 && (ar[0].nucleus()->asNestInset())) {
cur.handleNest(ar[0]);
} else
cur.niceInsert(cmd.argument);
break; break;
}
case LFUN_DIALOG_SHOW_NEW_INSET: { case LFUN_DIALOG_SHOW_NEW_INSET: {
string const & name = cmd.argument; string const & name = cmd.argument;