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()))
pos_type vpos = p.row->pos();
while (vpos <= last) {
+ if (p.x > p.bv->workWidth())
+ break;
pos_type pos = vis2log(vpos);
+ if (p.x + singleWidth(p.bv, par, pos) < 0) {
+ p.x += singleWidth(p.bv, par, pos);
+ ++vpos;
+ continue;
+ }
if (main_body > 0 && pos == main_body - 1) {
int const lwidth = lyxfont::width(layout.labelsep,
getLabelFont(buffer, par));