]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
First version of separate translation machinery for strings that go into
[lyx.git] / src / CutAndPaste.cpp
index 3d2bc2c324a8c751df7ec56facf948e98674f5dc..99f8383e6b027abf14a4fa222942e182cb34ccf8 100644 (file)
@@ -97,7 +97,7 @@ bool checkPastePossible(int index)
 
 
 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();
@@ -124,10 +124,9 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
        // 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)) {
@@ -538,7 +537,7 @@ void copySelectionHelper(Buffer const & buf, Text const & text,
                // 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());
        }
@@ -785,7 +784,12 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut)
 
                // 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);
@@ -1037,7 +1041,7 @@ void pasteClipboardGraphics(Cursor & cur, ErrorList & /* errorList */,
        // 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);