]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow.C
fix some C++ parsing bugs
[lyx.git] / src / lyxrow.C
index af4c7304fc91b8f5b18226fc44bf7da6a2f3f422..ca328bc33f5abdaa5eedb4647548b95af8acc384 100644 (file)
@@ -28,6 +28,30 @@ Row::Row()
 {}
 
 
+Paragraph * Row::par()
+{
+       return par_;
+}
+
+
+Paragraph * Row::par() const
+{
+       return par_;
+}
+
+
+unsigned short Row::height() const
+{
+       return height_;
+}
+
+
+Row * Row::next() const
+{
+       return next_;
+}
+
+
 void Row::par(Paragraph * p)
 {
        par_ = p;
@@ -144,7 +168,7 @@ bool Row::isParEnd() const
 
 pos_type Row::lastPos() const
 {
-       if (!par()->size())
+       if (par()->empty())
                return 0;
 
        if (isParEnd()) {
@@ -159,6 +183,9 @@ namespace {
 
 bool nextRowIsAllInset(Row const & row, pos_type last)
 {
+       if (last + 1 >= row.par()->size())
+               return false;
+
        if (!row.par()->isInset(last + 1))
                return false;
 
@@ -192,7 +219,7 @@ int Row::numberOfSeparators() const
        pos_type p = max(pos(), par()->beginningOfBody());
 
        int n = 0;
-       for (; p <= last; ++p) {
+       for (; p < last; ++p) {
                if (par()->isSeparator(p)) {
                        ++n;
                }
@@ -208,7 +235,7 @@ int Row::numberOfHfills() const
 
        // hfill *DO* count at the beginning of paragraphs!
        if (first) {
-               while (first <= last && par()->isHfill(first)) {
+               while (first < last && par()->isHfill(first)) {
                        ++first;
                }
        }
@@ -218,7 +245,7 @@ int Row::numberOfHfills() const
        int n = 0;
 
        // last, because the end is ignored!
-       for (pos_type p = first; p <= last; ++p) {
+       for (pos_type p = first; p < last; ++p) {
                if (par()->isHfill(p))
                        ++n;
        }