Edwin Leuven <[email protected]> writes:

> Jean-Marc Lasgouttes wrote:
>> Excellent idea :) However, about the implmentation:
>
> any objections if i commit the attached, or am is missing something?

I propose something even simpler:

* remove check for caption

* do not test for enumerations either.

(I checked that setLayout and changeDepth handle undo already)

What do you think of that?

JMarc

svndiff src/Text.cpp

Index: src/Text.cpp
===================================================================
--- src/Text.cpp	(révision 33084)
+++ src/Text.cpp	(copie de travail)
@@ -665,11 +665,13 @@ void Text::breakParagraph(Cursor & cur, 
 	DocumentClass const & tclass = cur.buffer()->params().documentClass();
 	Layout const & layout = cpar.layout();
 
-	// this is only allowed, if the current paragraph is not empty
-	// or caption and if it has not the keepempty flag active
-	if (cur.lastpos() == 0 && !cpar.allowEmpty() &&
-	    layout.labeltype != LABEL_SENSITIVE)
+	if (cur.lastpos() == 0 && !cpar.allowEmpty()) {
+		if (changeDepthAllowed(cur, DEC_DEPTH))
+			changeDepth(cur, DEC_DEPTH);
+		else 
+			setLayout(cur, tclass.defaultLayoutName());
 		return;
+	}
 
 	// a layout change may affect also the following paragraph
 	recUndo(cur, cur.pit(), undoSpan(cur.pit()) - 1);

Reply via email to