]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow_funcs.C
Point fix, earlier forgotten
[lyx.git] / src / lyxrow_funcs.C
index 85154f9d1333729f44e6cc6d567442280f765788..9dacc2aa219f9d206caac418c910fc0c10eb0e4d 100644 (file)
@@ -1,21 +1,46 @@
+/**
+ * \file lyxrow_funcs.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
 #include "lyxrow_funcs.h"
 #include "lyxtext.h"
 #include "paragraph.h"
 #include "lyxlayout.h"
+#include "debug.h"
+
+#include "support/LAssert.h"
 
 #include <boost/next_prior.hpp>
 #include <algorithm>
 
 using lyx::pos_type;
+using lyx::support::Assert;
 
 using std::max;
 using std::min;
+using std::endl;
 
 
 bool isParEnd(Paragraph const & par, RowList::iterator rit)
 {
+#if 0
+       if ((boost::next(rit) == par.rows.end()) != (rit->end() >= par.size())) {
+               lyxerr << endl;
+               lyxerr << "broken row 1: end: " << rit->end() << " next: "
+                       << boost::next(rit)->pos() << endl;
+               lyxerr << endl;
+               Assert(false);
+       }
+#endif
        return boost::next(rit) == par.rows.end();
 }
 
@@ -28,28 +53,17 @@ pos_type lastPos(Paragraph const & par, RowList::iterator rit)
        if (isParEnd(par, rit))
                return par.size() - 1;
 
+       if (1 && boost::next(rit)->pos() != rit->end()) {
+               lyxerr << endl;
+               lyxerr << "broken row 2: end: " << rit->end() << " next: "
+                       << boost::next(rit)->pos() << endl;
+               lyxerr << endl;
+               Assert(false);
+       }
        return boost::next(rit)->pos() - 1;
 }
 
 
-namespace {
-
-bool nextRowIsAllInset(
-       Paragraph const & par, pos_type last)
-{
-       if (last + 1 >= par.size())
-               return false;
-
-       if (!par.isInset(last + 1))
-               return false;
-
-       InsetOld const * i = par.getInset(last + 1);
-       return i->needFullRow() || i->display();
-}
-
-} // anon namespace
-
-
 pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit)
 {
        pos_type const last = lastPos(par, rit);
@@ -58,9 +72,6 @@ pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit)
        if (isParEnd(par, rit))
                return last;
 
-       if (!nextRowIsAllInset(par, last) && par.isSeparator(last))
-               return last - 1;
-
        return last;
 }