From: Abdelrazak Younes Date: Fri, 12 Sep 2008 13:36:40 +0000 (+0000) Subject: Get rid of indirections and add a check. X-Git-Tag: 1.6.10~3488 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=227ae7c2c740c1618d3941b2b3668ed9041ee619;p=features.git Get rid of indirections and add a check. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26370 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 813d28a2e3..6652b2ef5b 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -96,7 +96,9 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, Buffer const & buffer = cur.buffer(); pit_type pit = cur.pit(); pos_type pos = cur.pos(); - ParagraphList & pars = cur.text()->paragraphs(); + InsetText * target_inset = cur.inset().asInsetText(); + LASSERT(target_inset, return make_pair(PitPosPair(pit, pos), pit)); + ParagraphList & pars = target_inset->paragraphs(); if (parlist.empty()) return make_pair(PitPosPair(pit, pos), pit); @@ -190,11 +192,11 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, max_depth = tmpbuf->getMaxDepthAfter(); // Set the inset owner of this paragraph. - tmpbuf->setInsetOwner(pars[pit].inInset()); + tmpbuf->setInsetOwner(target_inset); for (pos_type i = 0; i < tmpbuf->size(); ++i) { // do not track deletion of invalid insets if (Inset * inset = tmpbuf->getInset(i)) - if (!pars[pit].insetAllowed(inset->lyxCode())) + if (target_inset->insetAllowed(inset->lyxCode())) tmpbuf->eraseChar(i--, false); }