[LyX/master] Split-inset fix

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue May 30 20:56:01 UTC 2023


commit c0d7ac5b71059b633a40cd798f9e2157961e7313
Author: Daniel Ramoeller <d.lyx at web.de>
Date:   Mon Apr 17 18:16:41 2023 +0200

    Split-inset fix
    
    - Remember whether something has to be pasted
    
    Fix for bug #12747
---
 src/Text.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index e876899..d8cd365 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -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


More information about the lyx-cvs mailing list