Le 07/10/2016 à 03:48, Scott Kostyshak a écrit :
I don't know much about layout nesting, but my first reaction is that I
agree with you regarding the expected behavior.

Did we figure out what the correct behavior for this is?

Please try that and tell me whether it works for you.

JMarc



>From 43658068801ad9772728973103414e81373e5a75 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Thu, 13 Oct 2016 20:33:57 +0200
Subject: [PATCH] When breaking an empty paragraph reduces depth, set layout
 too

---
 src/Text.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 007271d..16bf899 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -738,9 +738,13 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic)
 	Layout const & layout = cpar.layout();
 
 	if (cur.lastpos() == 0 && !cpar.allowEmpty()) {
-		if (changeDepthAllowed(cur, DEC_DEPTH))
+		if (changeDepthAllowed(cur, DEC_DEPTH)) {
 			changeDepth(cur, DEC_DEPTH);
-		else {
+			pit_type const prev = depthHook(cpit, cpar.getDepth());
+			docstring const & lay = pars_[prev].layout().name();
+			if (lay != layout.name())
+				setLayout(cur, lay);
+		} else {
 			docstring const & lay = cur.paragraph().usePlainLayout()
 			    ? tclass.plainLayoutName() : tclass.defaultLayoutName();
 			if (lay != layout.name())
-- 
2.7.4

Reply via email to