https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dc047f96303a05e94cdf5…
commit dc047f96303a05e94cdf51b7291528046fd249d2
Author: Joachim Henze <Joachim.Henze(a)reactos.org>
AuthorDate: Sun Nov 17 02:04:27 2019 +0100
Commit: Joachim Henze <Joachim.Henze(a)reactos.org>
CommitDate: Sun Nov 17 02:04:27 2019 +0100
[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
b931f643e35e6a23dbef99e785804039ea579b6a
---
dll/win32/browseui/desktopipc.cpp | 2 +-
dll/win32/shell32/CDefView.cpp | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dll/win32/browseui/desktopipc.cpp b/dll/win32/browseui/desktopipc.cpp
index 7c794b6133f..02d60cb488d 100644
--- a/dll/win32/browseui/desktopipc.cpp
+++ b/dll/win32/browseui/desktopipc.cpp
@@ -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);
}
diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp
index 66a77b608db..9fd104025a5 100644
--- a/dll/win32/shell32/CDefView.cpp
+++ b/dll/win32/shell32/CDefView.cpp
@@ -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);