On Mon, Jul 07, 2025 at 12:27:55PM -0400, Richard Kimberly Heck wrote:
> On 7/7/25 11:45 AM, Jean-Marc Lasgouttes wrote:
> > Le 07/07/2025 à 17:31, Scott Kostyshak a écrit :
> > > The root issue is the ones discussed above, that when we do Insert
> > > Branch on the selection, unexpected things happen.
> > 
> > Not with the selection done by the context menu, right? Only if the
> > end-of-paragraph of the previous paragraph has been selected too.
> 
> I'm still puzzled why this removes the section heading. Obviously, we have
> an empty Standard paragraph above now. That shouldn't, it seems to me, cause
> the next paragraph (the section) to be reset. What I'd expect is that the
> empty paragraph just disappears.
> 
> So there's this odd intermediate case: where you ONLY select the previous
> end of paragraph marker.

Attached is the local patch I use. If I use this patch and select the
section and insert it into a branch, it works as I expected.

I don't understand the technical details at all. But it's related to the
following:

https://www.lyx.org/trac/ticket/12251#comment:7

and to commits 2da183bf and d9af7a0f.

I would personally love to see this fixed. I think the main place where
I use it is when I want to put an item of a enumerate in a branch.

Scott
From aec4cb9ad050412cda6b543e16d1704665d07253 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sat, 23 Sep 2023 13:50:34 -0400
Subject: [PATCH 5/6] Put entire \item in a branch/note

sk: see https://www.lyx.org/trac/ticket/12251#comment:7

Revert "Check layout type when inserting inset over selection"
This reverts commit 2da183bf4f69847e30c9c9ab8a32548432a8a8b1.

Also reverts the following I think:

commit d9af7a0fff143b23ee60ddfe8c70456462831685
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sat Sep 16 13:31:00 2023 +0200

    Fix change tracking glitch (#12912)
---
 src/Text.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index e5468c864f..ed1ce5ada8 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -3691,10 +3691,7 @@ bool doInsertInset(Cursor & cur, Text * text,
 			 * paragraph and the inset allows setting layout
 			 * FIXME: figure out a good test in the environment case (see #12251).
 			 */
-			if (cur.paragraph().layout().isCommand()
-			     && (cur.paragraph().empty()
-				 || cur.paragraph().isDeleted(0, cur.paragraph().size()))
-			     && !inset->forcePlainLayout()) {
+			if (cur.paragraph().empty() && !inset->forcePlainLayout()) {
 				cur.paragraph().setPlainOrDefaultLayout(bparams.documentClass());
 				move_layout = true;
 			}
-- 
2.48.1

Attachment: signature.asc
Description: PGP signature

-- 
lyx-users mailing list
lyx-users@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to