]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Update toolbar and properly reset focus when find widget is closed (#12396)
[lyx.git] / src / CutAndPaste.cpp
index 6ab73f4be1334663f3456e9721e15a6e36c5a250..f79d4ace7c7dc8533df839c169e3e0ab8cc35c8b 100644 (file)
@@ -853,7 +853,10 @@ void switchBetweenClasses(DocumentClassConstPtr oldone,
                        docstring const & n = newone->insetLayout(layoutName).name();
                        bool const is_undefined = n.empty() ||
                                n == DocumentClass::plainInsetLayout().name();
-                       if (!is_undefined)
+                       docstring const & oldn = oldone->insetLayout(layoutName).name();
+                       bool const was_undefined = oldn.empty() ||
+                               oldn == DocumentClass::plainInsetLayout().name();
+                       if (!is_undefined || was_undefined)
                                continue;
 
                        // The flex inset is undefined in newtc
@@ -1260,6 +1263,7 @@ bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs,
                string lyx = theClipboard().getAsLyX();
                if (!lyx.empty()) {
                        Buffer buffer(string(), false);
+                       buffer.setInternal(true);
                        buffer.setUnnamed(true);
                        if (buffer.readString(lyx)) {
                                cur.recordUndo();
@@ -1293,6 +1297,7 @@ bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs,
                        available = !text.empty();
                        if (available) {
                                Buffer buffer(string(), false);
+                               buffer.setInternal(true);
                                buffer.setUnnamed(true);
                                available = buffer.importString(names[i], text, errorList);
                                if (available)