]> git.lyx.org Git - features.git/commitdiff
* removed the "dirty trick" to append a row with wrong start and
authorStefan Schimanski <sts@lyx.org>
Wed, 30 May 2007 06:44:18 +0000 (06:44 +0000)
committerStefan Schimanski <sts@lyx.org>
Wed, 30 May 2007 06:44:18 +0000 (06:44 +0000)
  end (but start and end inside of the buffer limits) for the last
  empty row behind a newline.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18576 a592a061-630c-0410-9148-cb99ea01b6c8

src/TextMetrics.cpp

index ba87f122d8a73fc652d51a5eb914f2599aaed25c..622ca3268883b93f423e41f846444304f4ae0440 100644 (file)
@@ -245,12 +245,9 @@ bool TextMetrics::redoParagraph(pit_type const pit)
 
        // Make sure that if a par ends in newline, there is one more row
        // under it
-       // FIXME this is a dirty trick. Now the _same_ position in the
-       // paragraph occurs in _two_ different rows, and has two different
-       // display positions, leading to weird behaviour when moving up/down.
        if (z > 0 && par.isNewline(z - 1)) {
-               Row row(z - 1);
-               row.endpos(z - 1);
+               Row row(z);
+               row.endpos(z);
                setRowWidth(right_margin, pit, row);
                setHeightOfRow(pit, row);
                pm.rows().push_back(row);
@@ -332,7 +329,7 @@ RowMetrics TextMetrics::computeRowMetrics(pit_type const pit,
                // The test on par.size() is to catch zero-size pars, which
                // would trigger the assert in Paragraph::getInset().
                //inset = par.size() ? par.getInset(row.pos()) : 0;
-               if (!par.empty()
+               if (row.pos() < par.size()
                    && par.isInset(row.pos()))
                {
                    switch(par.getInset(row.pos())->display()) {
@@ -790,7 +787,8 @@ void TextMetrics::setHeightOfRow(pit_type const pit,
                if (pit == 0 && row.pos() == 0)
                        maxasc += 20;
                if (pit + 1 == pit_type(pars.size()) &&
-                   row.endpos() == par.size())
+                   row.endpos() == par.size() &&
+                               !(row.endpos() > 0 && par.isNewline(row.endpos() - 1)))
                        maxdesc += 20;
        }