From 066de606d264276665bbf8d296d01a0aaff12ab7 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Tue, 13 Nov 2007 07:58:52 +0000 Subject: [PATCH] cosmetic git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21574 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathData.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 8bba8909e9..7d0f249c53 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -565,22 +565,24 @@ void MathData::attachMacroParameters(Cursor & cur, // remove them from the MathData erase(begin() + macroPos + 1, begin() + p); - // fix up cursor - if (thisSlice != -1) { - // fix cursor if right of p - if (thisPos >= int(p)) - cur[thisSlice].pos() -= p - (macroPos + 1); - // was the macro inset just inserted and was now folded? - if (cur[thisSlice].pos() == int(macroPos + 1) - && fromInitToNormalMode - && macroInset->arity() > 0 - && thisSlice + 1 == int(cur.depth())) { - // then enter it if the cursor was just behind - cur[thisSlice].pos() = macroPos; - cur.push_back(CursorSlice(*macroInset)); - macroInset->idxFirst(cur); - } + // no need to update the cursor? + if (thisSlice == -1) + return; + + // fix cursor if right of p + if (thisPos >= int(p)) + cur[thisSlice].pos() -= p - (macroPos + 1); + + // was the macro inset just inserted and was now folded? + if (cur[thisSlice].pos() == int(macroPos + 1) + && fromInitToNormalMode + && macroInset->arity() > 0 + && thisSlice + 1 == int(cur.depth())) { + // then enter it if the cursor was just behind + cur[thisSlice].pos() = macroPos; + cur.push_back(CursorSlice(*macroInset)); + macroInset->idxFirst(cur); } }