]> git.lyx.org Git - features.git/commitdiff
New behaviour when using break-paragraph on an empty paragraph where
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 18 Jan 2010 22:11:06 +0000 (22:11 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 18 Jan 2010 22:11:06 +0000 (22:11 +0000)
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

index c5d1501417853a8f00df2b75b9138147f5af731a..1b57b7bbde9b2c40807705cc492f4071d8525759 100644 (file)
@@ -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);