]> git.lyx.org Git - features.git/commitdiff
Fixed paragraph breaking mechanism for "keepempty" paragraphs (fix #390).
authorJürgen Vigna <jug@sad.it>
Tue, 14 May 2002 09:40:54 +0000 (09:40 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 14 May 2002 09:40:54 +0000 (09:40 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4159 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/paragraph.C
src/text.C

index b5887262b381cb1b2acc0a7d21f705838c8f9f19..33177df7abef02be71b3dbd97fe23200584bce8c 100644 (file)
@@ -1,3 +1,13 @@
+2002-05-14  Juergen Vigna  <jug@sad.it>
+
+       * text.C (breakParagraph): fixed function to honor the keepempty
+       layout in the right maner and also to permit the right breaking
+       algorithm on empty or non empyt keepempty paragraphs.
+
+       * paragraph.C (breakParagraph): we have to check also if the par
+       is really empty (!size()) for isempty otherwise we do the wrong
+       paragraph break.
+
 2002-05-10  Juergen Vigna  <jug@sad.it>
 
        * buffer.[Ch] : The following are only changes to the ert
index cbeb52eef19a4759e6bbe99e5089cc82a2122da1..e52de16bcc07183b4c44f1acbe4a073f4fa3223b 100644 (file)
@@ -891,7 +891,8 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
                tmp->setLabelWidthString(params().labelWidthString());
        }
 
-       bool isempty = textclasslist[bparams.textclass][layout()].keepempty;
+       bool isempty = (textclasslist[bparams.textclass][layout()].keepempty &&
+                       !size());
        if (!isempty && (size() > pos || !size() || flag == 2)) {
                tmp->layout(layout());
                tmp->params().align(params().align());
index 481c660610b374bf919aaae28cd3568bf984c88c..aad37b35057987bc9e0564451a032d2495e671a4 100644 (file)
@@ -1755,6 +1755,12 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
      keep_layout = 2;
    else
      keep_layout = layout.isEnvironment();
+
+   // we need to set this before we insert the paragraph. IMO the
+   // breakParagraph call should return a bool if it inserts the
+   // paragraph before or behind and we should react on that one
+   // but we can fix this in 1.3.0 (Jug 20020509)
+   bool const isempty = (layout.keepempty && !cursor.par()->size());
    cursor.par()->breakParagraph(bview->buffer()->params, cursor.pos(),
                                keep_layout);
 
@@ -1807,7 +1813,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() || layout.keepempty)
+   if (cursor.pos() || isempty)
           setCursor(bview, cursor.par()->next(), 0);
    else
           setCursor(bview, cursor.par(), 0);