mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Do BreakParagraph on an empty paragraph if it's flagged keepempty (fix #313).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3983 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ced212a684
commit
5a4fe1be41
@ -1,5 +1,11 @@
|
||||
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.
|
||||
|
||||
|
@ -884,7 +884,8 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
|
||||
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());
|
||||
@ -915,7 +916,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
|
||||
}
|
||||
|
||||
// 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());
|
||||
|
14
src/text.C
14
src/text.C
@ -1710,8 +1710,10 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
|
||||
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());
|
||||
@ -1747,7 +1749,8 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -1780,7 +1783,7 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
|
||||
|
||||
/* 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);
|
||||
@ -1907,13 +1910,14 @@ void LyXText::insertChar(BufferView * bview, char c)
|
||||
}
|
||||
} 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()))
|
||||
|
Loading…
Reference in New Issue
Block a user