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
This commit is contained in:
Jean-Marc Lasgouttes 2010-01-18 22:11:06 +00:00
parent 7226c955bb
commit c129f0f8b3

View 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);