From 8fb603762636348a94495cc0c0f1cfa7d60ee7bf Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Tue, 4 Oct 2005 17:58:46 +0000 Subject: [PATCH] Correct Page Up/Down handling in report mode. --- dlls/comctl32/listview.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 226bef67d06..b6f026d860b 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -8015,7 +8015,13 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK 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); @@ -8024,7 +8030,14 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK 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);