]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_funcs.C
couple more fixes
[lyx.git] / src / paragraph_funcs.C
index 597444fa1e5742c8b8f71cc7cc30726b70bb7829..c5b7171fa11e0ca64716a1b814ac7f9f64b147cf 100644 (file)
@@ -1,12 +1,12 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file paragraph_funcs.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
@@ -43,7 +43,7 @@ void breakParagraph(BufferParams const & bparams,
                tmp->setLabelWidthString(par->params().labelWidthString());
        }
 
-       bool isempty = (par->layout()->keepempty && par->empty());
+       bool const isempty = (par->layout()->keepempty && par->empty());
 
        if (!isempty && (par->size() > pos || par->empty() || flag == 2)) {
                tmp->layout(par->layout());
@@ -62,6 +62,14 @@ void breakParagraph(BufferParams const & bparams,
 
                // copy everything behind the break-position
                // to the new paragraph
+
+#ifdef WITH_WARNINGS
+#warning this seems wrong
+#endif
+               /* FIXME: if !keepempty, empty() == true, then we reach
+                * here with size() == 0. So pos_end becomes - 1. Why
+                * doesn't this cause problems ???
+                */
                pos_type pos_end = par->size() - 1;
                pos_type i = pos;
                pos_type j = pos;
@@ -75,24 +83,24 @@ void breakParagraph(BufferParams const & bparams,
                }
        }
 
-       // just an idea of me
-       if (!pos) {
-               tmp->params().lineTop(par->params().lineTop());
-               tmp->params().pagebreakTop(par->params().pagebreakTop());
-               tmp->params().spaceTop(par->params().spaceTop());
-               tmp->bibkey = par->bibkey;
+       if (pos)
+               return;
+       tmp->params().lineTop(par->params().lineTop());
+       tmp->params().pagebreakTop(par->params().pagebreakTop());
+       tmp->params().spaceTop(par->params().spaceTop());
+       tmp->bibkey = par->bibkey;
 
-               par->bibkey = 0;
-               par->params().clear();
+       par->bibkey = 0;
+       par->params().clear();
 
-               par->layout(bparams.getLyXTextClass().defaultLayout());
+       par->layout(bparams.getLyXTextClass().defaultLayout());
 
-               // layout stays the same with latex-environments
-               if (flag) {
-                       par->layout(tmp->layout());
-                       par->setLabelWidthString(tmp->params().labelWidthString());
-                       par->params().depth(tmp->params().depth());
-               }
+       // layout stays the same with latex-environments
+       if (flag) {
+               par->layout(tmp->layout());
+               par->setLabelWidthString(tmp->params().labelWidthString());
+               par->params().depth(tmp->params().depth());
        }
 }
 
@@ -125,13 +133,8 @@ void breakParagraphConservative(BufferParams const & bparams,
 }
 
 
-// Be carefull, this does not make any check at all.
-// This method has wrong name, it combined this par with the next par.
-// In that sense it is the reverse of break paragraph. (Lgb)
-void pasteParagraph(BufferParams const & bparams,
-                   Paragraph * par)
+void mergeParagraph(BufferParams const & bparams, Paragraph * par)
 {
-       // copy the next paragraph to this one
        Paragraph * the_next = par->next();
 
        // first the DTP-stuff