comctl32: Update first visible when appropiate in the TVI_SORT case.
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index b333fa3..a6aadf5 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -1299,6 +1299,7 @@
{
TREEVIEW_ITEM *aChild;
TREEVIEW_ITEM *previousChild = NULL;
+ TREEVIEW_ITEM *originalFirst = parentItem->firstChild;
BOOL bItemInserted = FALSE;
aChild = parentItem->firstChild;
@@ -1317,6 +1318,9 @@
if (comp < 0) /* we are smaller than the current one */
{
TREEVIEW_InsertBefore(newItem, aChild, parentItem);
+ if (infoPtr->firstVisible == originalFirst &&
+ aChild == originalFirst)
+ TREEVIEW_SetFirstVisible(infoPtr, newItem, TRUE);
bItemInserted = TRUE;
break;
}