comctl32:listview: Fix bug 1104

Vitaliy Margolen wine-patch at kievinfo.com
Mon Oct 3 16:33:42 CDT 2005


Fix bug 1104:
http://bugs.winehq.com/show_bug.cgi?id=1104

Vitaliy Margolen

changelog:
  comctl32: listview
  - Correct Page Up/Down handling in report mode
-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.430
diff -u -p -r1.430 listview.c
--- dlls/comctl32/listview.c	13 Sep 2005 14:30:53 -0000	1.430
+++ dlls/comctl32/listview.c	3 Oct 2005 21:31:28 -0000
@@ -8013,7 +8015,13 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW
 
   case VK_PRIOR:
     if (uView == LVS_REPORT)
-      nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(infoPtr);
+    {
+      INT topidx = LISTVIEW_GetTopIndex(infoPtr);
+      if (infoPtr->nFocusedItem == topidx)
+        nItem = topidx - LISTVIEW_GetCountPerColumn(infoPtr) + 1;
+      else
+        nItem = topidx;
+    }
     else
       nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(infoPtr)
                                     * LISTVIEW_GetCountPerRow(infoPtr);
@@ -8022,7 +8030,14 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW
 
   case VK_NEXT:
     if (uView == LVS_REPORT)
-      nItem = infoPtr->nFocusedItem + LISTVIEW_GetCountPerColumn(infoPtr);
+    {
+      INT topidx = LISTVIEW_GetTopIndex(infoPtr);
+      INT cnt = LISTVIEW_GetCountPerColumn(infoPtr);
+      if (infoPtr->nFocusedItem == topidx + cnt - 1)
+        nItem = infoPtr->nFocusedItem + cnt - 1;
+      else
+        nItem = topidx + cnt - 1;
+    }
     else
       nItem = infoPtr->nFocusedItem + LISTVIEW_GetCountPerColumn(infoPtr)
                                     * LISTVIEW_GetCountPerRow(infoPtr);


More information about the wine-patches mailing list