Adjust selection ranges before we insert the item so we don't mix the

new selection with the existing ones (reported by Eric Pouech).
This commit is contained in:
Dimitrie O. Paun 2003-09-04 19:38:44 +00:00 committed by Alexandre Julliard
parent 96b0b34282
commit 6d0019fb0e
1 changed files with 4 additions and 5 deletions

View File

@ -5939,6 +5939,9 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
if (nItem == -1) goto fail;
infoPtr->nItemCount++;
/* shift indices first so they don't get tangled */
LISTVIEW_ShiftIndices(infoPtr, nItem, 1);
/* set the item attributes */
if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS))
{
@ -5979,11 +5982,6 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
}
}
/* Add the subitem list to the items array. Do this last in case we go to
* fail during the above.
*/
LISTVIEW_ShiftIndices(infoPtr, nItem, 1);
/* send LVN_INSERTITEM notification */
ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
nmlv.iItem = nItem;
@ -6008,6 +6006,7 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
return nItem;
undo:
LISTVIEW_ShiftIndices(infoPtr, nItem, -1);
DPA_DeletePtr(infoPtr->hdpaItems, nItem);
infoPtr->nItemCount--;
fail: