From: Serge Gautherie Subject: [PATCH v3] comctl32: Improve LISTVIEW_Update?Scroll() a bit. Message-Id: <20191127033452.1064-1-winehq-git_serge_180711@gautherie.fr> Date: Wed, 27 Nov 2019 04:34:52 +0100 --- Adding '> 0' to 'if (infoPtr->nItemWidth)' is correct, isn't it? Are the two (different) comments correct as they are? --- dlls/comctl32/listview.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index acf6f31..0684d34 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -2033,12 +2033,14 @@ static INT LISTVIEW_UpdateHScroll(LISTVIEW_INFO *infoPtr) INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr); horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol; - /* scroll by at least one column per page */ - if(horzInfo.nPage < infoPtr->nItemWidth) - horzInfo.nPage = infoPtr->nItemWidth; - - if (infoPtr->nItemWidth) - horzInfo.nPage /= infoPtr->nItemWidth; + if (infoPtr->nItemWidth > 0) + { + /* scroll by at least one column per page */ + if (horzInfo.nPage <= infoPtr->nItemWidth) + horzInfo.nPage = 1; + else + horzInfo.nPage /= infoPtr->nItemWidth; + } } else if (infoPtr->uView == LV_VIEW_DETAILS) { @@ -2097,13 +2099,15 @@ static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr) if (infoPtr->uView == LV_VIEW_DETAILS) { vertInfo.nMax = infoPtr->nItemCount; - - /* scroll by at least one page */ - if(vertInfo.nPage < infoPtr->nItemHeight) - vertInfo.nPage = infoPtr->nItemHeight; if (infoPtr->nItemHeight > 0) - vertInfo.nPage /= infoPtr->nItemHeight; + { + /* scroll by at least one page */ + if (vertInfo.nPage <= infoPtr->nItemHeight) + vertInfo.nPage = 1; + else + vertInfo.nPage /= infoPtr->nItemHeight; + } } else if (infoPtr->uView != LV_VIEW_LIST) /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */ { -- 2.10.0.windows.1