[BROWSEUI][SHELL32] Fix scroll to selection CORE-16504

A patch by Katayama Hirofumi MZ

The bug was unhidden by
0.4.14-dev-312-g
b931f643e3
This commit is contained in:
Joachim Henze 2019-11-17 02:04:27 +01:00
parent e196149b71
commit dc047f9630
2 changed files with 9 additions and 4 deletions

View file

@ -380,7 +380,7 @@ static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters)
hResult = psb->QueryActiveShellView(&shellView);
if (SUCCEEDED(hResult))
{
shellView->SelectItem(pidlSelect, SVSI_SELECT|SVSI_ENSUREVISIBLE);
shellView->SelectItem(pidlSelect, SVSI_SELECT | SVSI_FOCUSED | SVSI_ENSUREVISIBLE);
}
ILFree(pidlSelect);
}

View file

@ -2379,9 +2379,6 @@ HRESULT WINAPI CDefView::SelectItem(PCUITEMID_CHILD pidl, UINT uFlags)
if (i == -1)
return S_OK;
if(uFlags & SVSI_ENSUREVISIBLE)
m_ListView.EnsureVisible(i, FALSE);
LVITEMW lvItem = {0};
lvItem.mask = LVIF_STATE;
lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
@ -2396,18 +2393,26 @@ HRESULT WINAPI CDefView::SelectItem(PCUITEMID_CHILD pidl, UINT uFlags)
lvItem.state &= ~LVIS_SELECTED;
if (uFlags & SVSI_FOCUSED)
lvItem.state |= LVIS_FOCUSED;
else
lvItem.state &= ~LVIS_FOCUSED;
}
else
{
if (uFlags & SVSI_DESELECTOTHERS)
{
lvItem.state &= ~LVIS_SELECTED;
}
lvItem.state &= ~LVIS_FOCUSED;
}
m_ListView.SetItem(&lvItem);
lvItem.iItem++;
}
if (uFlags & SVSI_ENSUREVISIBLE)
m_ListView.EnsureVisible(i, FALSE);
if((uFlags & SVSI_EDIT) == SVSI_EDIT)
m_ListView.EditLabel(i);