In LISTVIEW_AddGroupSelection and LISTVIEW_SetGroupSelection, if no selection mark has been set, just select the current item. In LISTVIEW_SetGroupSelection we must also set the selection mark in that case (and only in that case). Removed a naughty ';' (spotted by Eric Pouech).
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 19ac596..436a342 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c
@@ -1538,11 +1538,14 @@ INT i; LVITEMA item; + if (nFirst == -1) + nFirst = nItem; + ZeroMemory(&item,sizeof(LVITEMA)); item.stateMask = LVIS_SELECTED; item.state = LVIS_SELECTED; - for (i = nFirst; i <= nLast; i++); + for (i = nFirst; i <= nLast; i++) { LISTVIEW_SetItemState(hwnd,i,&item); } @@ -1679,8 +1682,17 @@ if ((uView == LVS_LIST) || (uView == LVS_REPORT)) { INT i; - INT nFirst = min(infoPtr->nSelectionMark, nItem); - INT nLast = max(infoPtr->nSelectionMark, nItem); + INT nFirst, nLast; + + if (infoPtr->nSelectionMark == -1) + { + infoPtr->nSelectionMark = nFirst = nLast = nItem; + } + else + { + nFirst = min(infoPtr->nSelectionMark, nItem); + nLast = max(infoPtr->nSelectionMark, nItem); + } for (i = 0; i <= GETITEMCOUNT(infoPtr); i++) {