]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow.C
Oops...
[lyx.git] / src / lyxrow.C
index 70edc13f1b0a0c17ed9ade1806a9e8bbdcee8645..7351b7f2481c8896ac4b72b0db4c1a91d59acf0f 100644 (file)
@@ -93,13 +93,13 @@ void Row::top_of_text(unsigned int top)
        top_of_text_ = top;
 }
 
+
 unsigned int Row::top_of_text() const
 {
        return top_of_text_;
 }
 
+
 void Row::baseline(unsigned int b)
 {
        baseline_ = b;
@@ -130,12 +130,24 @@ Row * Row::previous() const
 }
 
 
+bool Row::isParStart() const
+{
+       return !pos();
+}
+
+
+bool Row::isParEnd() const
+{
+       return !next() || next()->par() != par();
+}
+
+
 pos_type Row::lastPos() const
 {
        if (!par()->size())
                return 0;
 
-       if (!next() || next()->par() != par()) {
+       if (isParEnd()) {
                return par()->size() - 1;
        } else {
                return next()->pos() - 1;
@@ -147,12 +159,6 @@ namespace {
 
 bool nextRowIsAllInset(Row const & row, pos_type last)
 {
-       if (!row.next())
-               return false;
-
-       if (row.par() != row.next()->par())
-               return false;
-
        if (!row.par()->isInset(last + 1))
                return false;
 
@@ -166,9 +172,14 @@ bool nextRowIsAllInset(Row const & row, pos_type last)
 pos_type Row::lastPrintablePos() const
 {
        pos_type const last = lastPos();
-       bool const ignore_space_at_last = !nextRowIsAllInset(*this, last);
 
-       if (ignore_space_at_last && par()->isSeparator(last))
+       // if this row is an end of par, just act like lastPos()
+       if (isParEnd())
+               return last;
+
+       bool const nextrownotinset = !nextRowIsAllInset(*this, last);
+
+       if (nextrownotinset && par()->isSeparator(last))
                return last - 1;
 
        return last;
@@ -257,7 +268,7 @@ bool Row::hfillExpansion(pos_type pos) const
 
        // at the beginning of a row it does not count, if it is not
        // the first row of a paragaph
-       if (!this->pos())
+       if (isParStart())
                return true;
 
        // in some labels  it does not count