[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [Haiku-commits] r30933 - haiku/trunk/src/kits/interface
From:       zooey at BerliOS <zooey () mail ! berlios ! de>
Date:       2009-05-30 21:07:37
Message-ID: 200905302107.n4UL7bcw031336 () sheep ! berlios ! de
[Download RAW message or body]

Author: zooey
Date: 2009-05-30 23:07:36 +0200 (Sat, 30 May 2009)
New Revision: 30933
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30933&view=rev

Modified:
   haiku/trunk/src/kits/interface/TextView.cpp
Log:
* 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


Modified: haiku/trunk/src/kits/interface/TextView.cpp
===================================================================
--- haiku/trunk/src/kits/interface/TextView.cpp	2009-05-30 20:10:12 UTC (rev 30932)
+++ haiku/trunk/src/kits/interface/TextView.cpp	2009-05-30 21:07:36 UTC (rev 30933)
@@ -3507,12 +3507,14 @@
 
 		case B_PAGE_UP:
 		{
-			BPoint currentPos = PointAt(fClickOffset);
+			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);
 
-			currentPos.y -= Bounds().Height();
-			fClickOffset = OffsetAt(LineAt(currentPos));
-			_ScrollBy(0, -1 * Bounds().Height());
-
 			if (!fEditable)
 				break;
 
@@ -3538,11 +3540,11 @@
 		case B_PAGE_DOWN:
 		{
 			BPoint currentPos = PointAt(fClickOffset);
+			BPoint nextPos(currentPos.x, currentPos.y + Bounds().Height());
+			fClickOffset = OffsetAt(nextPos);
+			nextPos = PointAt(fClickOffset);
+			_ScrollBy(0, nextPos.y - currentPos.y);
 
-			currentPos.y += Bounds().Height();
-			fClickOffset = OffsetAt(LineAt(currentPos));
-			_ScrollBy(0, Bounds().Height());
-
 			if (!fEditable)
 				break;
 

_______________________________________________
Haiku-commits mailing list
Haiku-commits@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/haiku-commits

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic