]> git.lyx.org Git - features.git/commitdiff
Split-inset fix
authorDaniel Ramoeller <d.lyx@web.de>
Mon, 17 Apr 2023 16:16:41 +0000 (18:16 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 30 May 2023 22:05:23 +0000 (00:05 +0200)
- Remember whether something has to be pasted

Fix for bug #12747

src/Text.cpp

index e87689990ffef71b2203ff274942333d583ac8bf..d8cd365093e53313f700b65370b94123f4b5ad7e 100644 (file)
@@ -2007,6 +2007,9 @@ bool Text::splitInset(Cursor & cur)
                cur.resetAnchor();
                setCursor(cur, cur.lastpit(), getPar(cur.lastpit()).size());
                cur.setSelection();
+               // Remember whether there was something cut that has to be pasted below
+               // (bug #12747)
+               bool const hasCut = cur.selection();
                cap::cutSelectionToTemp(cur);
                cur.setMark(false);
                cur.selHandle(false);
@@ -2028,7 +2031,9 @@ bool Text::splitInset(Cursor & cur)
                cur.resetAnchor();
                cur.text()->selectAll(cur);
                cutSelection(cur, false);
-               cap::pasteFromTemp(cur, cur.buffer()->errorList("Paste"));
+               // If there was something cut paste it
+               if (hasCut)
+                       cap::pasteFromTemp(cur, cur.buffer()->errorList("Paste"));
                cur.text()->setCursor(cur, 0, 0);
                if (atlastpos && cur.paragraph().isFreeSpacing() && cur.paragraph().empty()) {
                        // We started from par end, remove extra empty par in free spacing insets