X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCutAndPaste.cpp;h=901b7d7f4a6abafe0d4bcd587e91c64884f10506;hb=f83a38b3defc997f808539d0dfd618f5ba71e13c;hp=6652b2ef5b54548aa1af85426e010dba4ab58cc9;hpb=227ae7c2c740c1618d3941b2b3668ed9041ee619;p=lyx.git diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 6652b2ef5b..901b7d7f4a 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -115,14 +115,14 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, // Convert newline to paragraph break in ERT inset. // This should not be here! - Inset * inset = pars[pit].inInset(); - if (inset && (inset->lyxCode() == ERT_CODE || - inset->lyxCode() == LISTINGS_CODE)) { + InsetCode const code = target_inset->lyxCode(); + if (code == ERT_CODE || code == LISTINGS_CODE) { for (size_t i = 0; i != insertion.size(); ++i) { for (pos_type j = 0; j != insertion[i].size(); ++j) { if (insertion[i].isNewline(j)) { // do not track deletion of newline insertion[i].eraseChar(j, false); + insertion[i].setInsetOwner(target_inset); breakParagraphConservative( buffer.params(), insertion, i, j); @@ -196,7 +196,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, for (pos_type i = 0; i < tmpbuf->size(); ++i) { // do not track deletion of invalid insets if (Inset * inset = tmpbuf->getInset(i)) - if (target_inset->insetAllowed(inset->lyxCode())) + if (!target_inset->insetAllowed(inset->lyxCode())) tmpbuf->eraseChar(i--, false); }