Commit 69f2e04f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

Deleting column zero should only delete the column and not the item

data.
parent 759ef459
......@@ -4229,13 +4229,9 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
|| nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
/* While the MSDN specifically says that column zero should not be deleted,
it does in fact work on WinNT, and at least one app depends on it. On
WinNT, deleting column zero deletes the last column of items but the
first header. Since no app will ever depend on that bizarre behavior,
we just delete the last column including the header.
what actually happens is that the column itself is deleted but no items or subitems
are removed.
*/
if (nColumn == 0)
nColumn = DPA_GetPtrCount(infoPtr->hdpaColumns) - 1;
LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
......@@ -4245,15 +4241,12 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
Free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn));
DPA_DeletePtr(infoPtr->hdpaColumns, nColumn);
if (!(infoPtr->dwStyle & LVS_OWNERDATA))
if (!(infoPtr->dwStyle & LVS_OWNERDATA) && nColumn)
{
SUBITEM_INFO *lpSubItem, *lpDelItem;
HDPA hdpaSubItems;
INT nItem, nSubItem, i;
if (nColumn == 0)
return LISTVIEW_DeleteAllItems(infoPtr);
for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
{
hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem);
......@@ -4290,7 +4283,10 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
}
/* update the other column info */
LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0)
LISTVIEW_InvalidateList(infoPtr);
else
LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment