* Instead of moving bounds-height during paging, we now determine the exact

next position of the caret and only scroll the distance between the current
  and the next position. This fixes #3981
* When paging upwards, we need to compensate for the fact that the caret 
  position is always considered at the top of the line, as otherwise a
  page-up would pass one more line than a page-down


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30933 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2009-05-30 21:07:36 +00:00
parent 93aba444aa
commit f2e0ac2cd7
+11 -9
View File
@@ -3507,11 +3507,13 @@ BTextView::_HandlePageKey(uint32 inPageKey)
case B_PAGE_UP: case B_PAGE_UP:
{ {
BPoint currentPos = PointAt(fClickOffset); float lineHeight;
BPoint currentPos = PointAt(fClickOffset, &lineHeight);
currentPos.y -= Bounds().Height(); BPoint nextPos(currentPos.x,
fClickOffset = OffsetAt(LineAt(currentPos)); currentPos.y + lineHeight - Bounds().Height());
_ScrollBy(0, -1 * Bounds().Height()); fClickOffset = OffsetAt(nextPos);
nextPos = PointAt(fClickOffset);
_ScrollBy(0, nextPos.y - currentPos.y);
if (!fEditable) if (!fEditable)
break; break;
@@ -3538,10 +3540,10 @@ BTextView::_HandlePageKey(uint32 inPageKey)
case B_PAGE_DOWN: case B_PAGE_DOWN:
{ {
BPoint currentPos = PointAt(fClickOffset); BPoint currentPos = PointAt(fClickOffset);
BPoint nextPos(currentPos.x, currentPos.y + Bounds().Height());
currentPos.y += Bounds().Height(); fClickOffset = OffsetAt(nextPos);
fClickOffset = OffsetAt(LineAt(currentPos)); nextPos = PointAt(fClickOffset);
_ScrollBy(0, Bounds().Height()); _ScrollBy(0, nextPos.y - currentPos.y);
if (!fEditable) if (!fEditable)
break; break;