]> git.lyx.org Git - features.git/commitdiff
Reset buffer language only if we have something to reset.
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 9 Mar 2018 11:15:19 +0000 (12:15 +0100)
committerRichard Heck <rgheck@lyx.org>
Sat, 17 Mar 2018 19:44:05 +0000 (15:44 -0400)
Fixes: #11063
(cherry picked from commit 599b1222f7da0222cd1802af69abefb81145f566)

src/CutAndPaste.cpp

index bf2986decd934b29a719dab51f1da3490a365ff5..d078cb975914a066d4e2ddd5fa66b2b308163697 100644 (file)
@@ -1228,13 +1228,13 @@ bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs,
                                Buffer buffer("", false);
                                buffer.setUnnamed(true);
                                available = buffer.importString(names[i], text, errorList);
-                               // TeX2lyx (also used in the HTML chain) assumes English as document language
-                               // if no language is explicitly set (as is the case here).
-                               // We thus reset the temp buffer's language to the context language
-                               buffer.changeLanguage(buffer.language(), cur.getFont().language());
                                if (available)
                                        available = !buffer.paragraphs().empty();
                                if (available && !buffer.paragraphs()[0].empty()) {
+                                       // TeX2lyx (also used in the HTML chain) assumes English as document language
+                                       // if no language is explicitly set (as is the case here).
+                                       // We thus reset the temp buffer's language to the context language
+                                       buffer.changeLanguage(buffer.language(), cur.getFont().language());
                                        cur.recordUndo();
                                        pasteParagraphList(cur, buffer.paragraphs(),
                                                buffer.params().documentClassPtr(), errorList);