commit 4886c0370b32dd00e4fc435d596f86ee3ae7cc2e
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Dec 27 14:28:03 2020 +0100

    inset-split: consider that freeSpacing() doesn't DEPM
---
 src/Text.cpp |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 1f8288a..8435b73 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -1950,10 +1950,13 @@ bool Text::splitInset(Cursor & cur)
                cur.setMark(false);
                cur.selHandle(false);
                cur.resetAnchor();
-               Cursor dummy = cur;
-               dummy.pos() = dummy.pit() = 0;
-               if (cur.bv().checkDepm(dummy, cur))
+               bool atlastpos;
+               if (cur.pos() == 0 && cur.pit() > 0) {
+                       // if we are at par start, remove this par
+                       cur.text()->backspace(cur);
                        cur.forceBufferUpdate();
+               } else if (cur.pos() == cur.lastpos())
+                       atlastpos = true;
                // Move out of and jump over inset
                cur.popBackward();
                ++cur.pos();
@@ -1966,6 +1969,11 @@ bool Text::splitInset(Cursor & cur)
                cutSelection(cur, false);
                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
+                       cur.text()->erase(cur);
+                       cur.forceBufferUpdate();
+               }
        }
 
        cur.finishUndo();
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to