pair<PitPosPair, pit_type>
-pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
+pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist,
DocumentClass const * const oldDocClass, ErrorList & errorlist)
{
Buffer const & buffer = *cur.buffer();
// Now remove all out of the pars which is NOT allowed in the
// new environment and set also another font if that is required.
- // Convert newline to paragraph break in ERT inset.
- // This should not be here!
- InsetCode const code = target_inset->lyxCode();
- if (code == ERT_CODE || code == LISTINGS_CODE) {
+ // Convert newline to paragraph break in ParbreakIsNewline
+ if (target_inset->getLayout().parbreakIsNewline()
+ || pars[pit].layout().parbreak_is_newline) {
for (size_t i = 0; i != insertion.size(); ++i) {
for (pos_type j = 0; j != insertion[i].size(); ++j) {
if (insertion[i].isNewline(j)) {
// PassThru paragraphs have the Language
// latex_language. This is invalid for others, so we
// need to change it to the buffer language.
- if (text.inset().getLayout().isPassThru())
+ if (it->isPassThru())
it->changeLanguage(buf.params(),
latex_language, buf.language());
}
// need a valid cursor. (Lgb)
cur.clearSelection();
- cur.forceBufferUpdate();
+
+ // After a cut operation, we must make sure that the Buffer is updated
+ // because some further operation might need updated label information for
+ // example. So we cannot just use "cur.forceBufferUpdate()" here.
+ // This fixes #7071.
+ cur.buffer()->updateBuffer();
// tell tabular that a recent copy happened
dirtyTabularStack(false);
// create inset for graphic
InsetGraphics * inset = new InsetGraphics(cur.buffer());
InsetGraphicsParams params;
- params.filename = support::DocFileName(filename.absFileName());
+ params.filename = support::DocFileName(filename.absFileName(), false);
inset->setParams(params);
cur.recordUndo();
cur.insert(inset);