2002-04-12 Juergen Vigna <jug@sad.it>
+ * text.C (breakParagraph): honor keepempty flag and break the paragraph
+ also with no chars on this paragraph.
+
+ * paragraph.C (breakParagraph): honor keepempty flag and break the
+ paragraph always below not above.
+
* BufferView2.C (unlockInset): update the paragraph layout on inset
unlock as we changed paragraph in such a case.
tmp->setLabelWidthString(params().labelWidthString());
}
- if (size() > pos || !size() || flag == 2) {
+ bool isempty = textclasslist[bparams.textclass][layout()].keepempty;
+ if (!isempty && (size() > pos || !size() || flag == 2)) {
tmp->layout(layout());
tmp->params().align(params().align());
tmp->setLabelWidthString(params().labelWidthString());
}
// just an idea of me
- if (!pos) {
+ if (!isempty && !pos) {
tmp->params().lineTop(params().lineTop());
tmp->params().pagebreakTop(params().pagebreakTop());
tmp->params().spaceTop(params().spaceTop());
LyXLayout const & layout = tclass[cursor.par()->layout()];
// this is only allowed, if the current paragraph is not empty or caption
+ // and if it has not the keepempty flag aktive
if ((cursor.par()->size() <= 0)
- && layout.labeltype!= LABEL_SENSITIVE)
+ && layout.labeltype != LABEL_SENSITIVE
+ && !layout.keepempty)
return;
setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next());
* This touches only the screen-update. Otherwise we would may have
* an empty row on the screen */
if (cursor.pos() && !cursor.row()->par()->isNewline(cursor.row()->pos() - 1)
- && cursor.row()->pos() == cursor.pos()) {
+ && cursor.row()->pos() == cursor.pos())
+ {
cursorLeft(bview);
}
/* This check is necessary. Otherwise the new empty paragraph will
* be deleted automatically. And it is more friendly for the user! */
- if (cursor.pos())
+ if (cursor.pos() || layout.keepempty)
setCursor(bview, cursor.par()->next(), 0);
else
setCursor(bview, cursor.par(), 0);
}
} else if (IsNewlineChar(c)) {
if (cursor.pos() <= beginningOfMainBody(bview->buffer(),
- cursor.par())) {
+ cursor.par()))
+ {
charInserted();
return;
}
/* No newline at first position
* of a paragraph or behind labels.
- * TeX does not allow that. */
+ * TeX does not allow that */
if (cursor.pos() < cursor.par()->size() &&
cursor.par()->isLineSeparator(cursor.pos()))