]> 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 150fd8a6464879f517c69dcb2339b9f52b37bbe6..f79d4ace7c7dc8533df839c169e3e0ab8cc35c8b 100644 (file)
@@ -797,6 +797,13 @@ bool multipleCellsSelected(CursorData const & cur)
 }
 
 
+void switchBetweenClasses(DocumentClassConstPtr oldone,
+               DocumentClassConstPtr newone, InsetText & in) {
+       ErrorList el = {};
+       switchBetweenClasses(oldone, newone, in, el);
+}
+
+
 void switchBetweenClasses(DocumentClassConstPtr oldone,
                DocumentClassConstPtr newone, InsetText & in, ErrorList & errorlist)
 {
@@ -846,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
@@ -1253,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();
@@ -1286,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)