[LyX/master] Refactor code to avoid the problem fixed at the last commit.

Richard Kimberly Heck rikiheck at lyx.org
Sat Apr 25 04:47:39 UTC 2020


commit c67b6be77e09537250b789bea9c6273e9cec8b97
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Sat Apr 25 01:11:30 2020 -0400

    Refactor code to avoid the problem fixed at the last commit.
---
 src/Text.cpp |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index fa4e2a8..ac6dda5 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -1800,12 +1800,6 @@ bool Text::dissolveInset(Cursor & cur)
 	// save position inside inset
 	pos_type spos = cur.pos();
 	pit_type spit = cur.pit();
-	ParagraphList plist;
-	if (cur.lastpit() != 0 || cur.lastpos() != 0) {
-		plist = paragraphs();
-		for (auto & p : plist)
-			p.setInsetBuffers(*cur.buffer());
-	}
 	cur.popBackward();
 	// update cursor offset
 	if (spit == 0)
@@ -1818,7 +1812,8 @@ bool Text::dissolveInset(Cursor & cur)
 	++cur.pos();
 
 	Buffer & b = *cur.buffer();
-	if (!plist.empty()) {
+	// Is there anything in this text?
+	if (cur.lastpit() != 0 || cur.lastpos() != 0) {
 		// see bug 7319
 		// we clear the cache so that we won't get conflicts with labels
 		// that get pasted into the buffer. we should update this before
@@ -1828,6 +1823,7 @@ bool Text::dissolveInset(Cursor & cur)
 		// but we'll try the cheaper solution here.
 		cur.buffer()->clearReferenceCache();
 
+		ParagraphList & plist = paragraphs();
 		if (!lyxrc.ct_markup_copied)
 			// Do not revive deleted text
 			lyx::acceptChanges(plist, b.params());


More information about the lyx-cvs mailing list