Fix bug #7662: Incorrect scrolling for rows with larger ascent.

- After introducing the displayed vertical alignment for tables, we met for the first time situations in which row.ascent is very large. To make sure the scrolling still works, we have to do the same as we did for rows with a large descent.
- change row.ascent into defaultRowHeight. Before the above mentioned change, row.ascent usually was approximately the same as defaultRowHeight (by chance). However, it is now clear we don't really want row.ascent here.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39486 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2011-08-17 10:44:50 +00:00
parent c29d13569e
commit d631fe0001

View File

@ -888,16 +888,25 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool recenter)
// If the top part of the row falls of the screen, we scroll // If the top part of the row falls of the screen, we scroll
// up to align the top of the row with the top of the screen. // up to align the top of the row with the top of the screen.
else if (ypos - row_dim.ascent() < 0) else if (ypos - row_dim.ascent() < 0 && ypos < height_) {
scrolled = scrollUp(-ypos + row_dim.ascent()); int ynew = row_dim.ascent();
if (ynew > height_ - row_dim.descent())
// FIXME: Recursively find the rowheight of the row in the inset
// until we find a row which can be visualized completely.
ynew = height_ - defaultRowHeight();
int const scroll = ynew - ypos;
scrolled = scrollUp(scroll);
}
// If the bottom of the row falls of the screen, we scroll down. // If the bottom of the row falls of the screen, we scroll down.
// However, we have to be careful not to scroll that much that // However, we have to be careful not to scroll that much that
// the top falls of the screen. // the top falls of the screen.
else if (ypos + row_dim.descent() > height_) { else if (ypos + row_dim.descent() > height_ && ypos > 0) {
int ynew = height_ - row_dim.descent(); int ynew = height_ - row_dim.descent();
if (ynew < row_dim.ascent()) if (ynew < row_dim.ascent())
ynew = row_dim.ascent(); // FIXME: Recursively find the rowheight of the row in the inset
// until we find a row which can be visualized completely.
ynew = defaultRowHeight();
int const scroll = ypos - ynew; int const scroll = ypos - ynew;
scrolled = scrollDown(scroll); scrolled = scrollDown(scroll);
} }