* 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

View File

@ -3507,11 +3507,13 @@ BTextView::_HandlePageKey(uint32 inPageKey)
case B_PAGE_UP:
{
BPoint currentPos = PointAt(fClickOffset);
currentPos.y -= Bounds().Height();
fClickOffset = OffsetAt(LineAt(currentPos));
_ScrollBy(0, -1 * Bounds().Height());
float lineHeight;
BPoint currentPos = PointAt(fClickOffset, &lineHeight);
BPoint nextPos(currentPos.x,
currentPos.y + lineHeight - Bounds().Height());
fClickOffset = OffsetAt(nextPos);
nextPos = PointAt(fClickOffset);
_ScrollBy(0, nextPos.y - currentPos.y);
if (!fEditable)
break;
@ -3538,10 +3540,10 @@ BTextView::_HandlePageKey(uint32 inPageKey)
case B_PAGE_DOWN:
{
BPoint currentPos = PointAt(fClickOffset);
currentPos.y += Bounds().Height();
fClickOffset = OffsetAt(LineAt(currentPos));
_ScrollBy(0, Bounds().Height());
BPoint nextPos(currentPos.x, currentPos.y + Bounds().Height());
fClickOffset = OffsetAt(nextPos);
nextPos = PointAt(fClickOffset);
_ScrollBy(0, nextPos.y - currentPos.y);
if (!fEditable)
break;