From f4c0f6ec8bd7760e9f914124391d99c10fe11288 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Wed, 6 Apr 2005 19:01:55 +0000 Subject: [PATCH] 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 --- src/mathed/ChangeLog | 6 ++++++ src/mathed/math_nestinset.C | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 7c7870b7a7..4dcc85be4a 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,9 @@ +2005-04-06 Martin Vermeer + + * 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 * math_amsarrayinset.C: diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 9c66c3d898..8f3f8cfb6c 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -557,7 +557,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd) cur.clearTargetX(); if (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.pos() = cur.lastpos(); } 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" // handling such that "self-insert" works on "arbitrary stuff" too, and // math-insert only handles special math things like "matrix". - case LFUN_INSERT_MATH: + case LFUN_INSERT_MATH: { 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; + } case LFUN_DIALOG_SHOW_NEW_INSET: { string const & name = cmd.argument; -- 2.39.2