From c129f0f8b30902833aec1e24d93c27d775312e73 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 18 Jan 2010 22:11:06 +0000 Subject: [PATCH] New behaviour when using break-paragraph on an empty paragraph where KeepEmpty is false: * if depth>0, decrease depth * if depth = 0 reset layout to standard This implments a hopefully intuitive way of getting out of enumerations and other environments. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33088 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Text.cpp b/src/Text.cpp index c5d1501417..1b57b7bbde 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -665,11 +665,13 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic) 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);