Little bit of cleanup.

This commit is contained in:
Richard Heck 2014-08-12 13:13:47 -04:00
parent dd0f71e5fe
commit 96d75db418

View File

@ -118,22 +118,23 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist,
pit_type pit = cur.pit(); pit_type pit = cur.pit();
pos_type pos = cur.pos(); pos_type pos = cur.pos();
bool need_update = false; bool need_update = false;
if (parlist.empty())
return PasteReturnValue(pit, pos, need_update);
InsetText * target_inset = cur.inset().asInsetText(); InsetText * target_inset = cur.inset().asInsetText();
if (!target_inset) { if (!target_inset) {
InsetTabular * it = cur.inset().asInsetTabular(); InsetTabular * it = cur.inset().asInsetTabular();
target_inset = it? it->cell(cur.idx())->asInsetText() : 0; target_inset = it? it->cell(cur.idx())->asInsetText() : 0;
} }
LASSERT(target_inset, return PasteReturnValue(pit, pos, need_update)); LASSERT(target_inset, return PasteReturnValue(pit, pos, need_update));
ParagraphList & pars = target_inset->paragraphs(); ParagraphList & pars = target_inset->paragraphs();
LASSERT(pos <= pars[pit].size(),
if (parlist.empty()) return PasteReturnValue(pit, pos, need_update));
return PasteReturnValue(pit, pos, need_update);
BOOST_ASSERT (pos <= pars[pit].size());
// Make a copy of the CaP paragraphs. // Make a copy of the CaP paragraphs.
ParagraphList insertion = parlist; ParagraphList insertion = parlist;
DocumentClassConstPtr newDocClass = buffer.params().documentClassPtr();
// Now remove all out of the pars which is NOT allowed in the // Now remove all out of the pars which is NOT allowed in the
// new environment and set also another font if that is required. // new environment and set also another font if that is required.
@ -157,6 +158,7 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist,
} }
// set the paragraphs to plain layout if necessary // set the paragraphs to plain layout if necessary
DocumentClassConstPtr newDocClass = buffer.params().documentClassPtr();
if (cur.inset().usePlainLayout()) { if (cur.inset().usePlainLayout()) {
bool forcePlainLayout = cur.inset().forcePlainLayout(); bool forcePlainLayout = cur.inset().forcePlainLayout();
Layout const & plainLayout = newDocClass->plainLayout(); Layout const & plainLayout = newDocClass->plainLayout();