https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2fd058dce6058804f4bcc…
commit 2fd058dce6058804f4bcce7226bf84467a77083a
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Apr 7 13:38:22 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Apr 7 13:38:22 2021 +0900
[BROWSEUI] Reduce IAutoComplete failures (#3590)
- Delete OnEditUpdate method.
- Improve the expand condition.
CORE-9281
---
dll/win32/browseui/CAutoComplete.cpp | 27 ++++++++++++---------------
dll/win32/browseui/CAutoComplete.h | 1 -
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/dll/win32/browseui/CAutoComplete.cpp b/dll/win32/browseui/CAutoComplete.cpp
index df0291021f0..6f2033d9f9f 100644
--- a/dll/win32/browseui/CAutoComplete.cpp
+++ b/dll/win32/browseui/CAutoComplete.cpp
@@ -291,7 +291,7 @@ LRESULT CAutoComplete::EditWndProc(HWND hwnd, UINT uMsg, WPARAM
wParam, LPARAM l
return OnEditChar(wParam, lParam);
case WM_CUT: case WM_PASTE: case WM_CLEAR:
ret = ::DefSubclassProc(hwnd, uMsg, wParam, lParam); // do default
- OnEditUpdate(TRUE);
+ UpdateCompletion(TRUE);
return ret;
case WM_GETDLGCODE:
ret = ::DefSubclassProc(hwnd, uMsg, wParam, lParam); // do default
@@ -950,7 +950,7 @@ BOOL CAutoComplete::OnEditKeyDown(WPARAM wParam, LPARAM lParam)
if (!CanAutoSuggest())
return FALSE; // do default
::DefSubclassProc(m_hwndEdit, WM_KEYDOWN, VK_DELETE, 0); // do default
- OnEditUpdate(FALSE);
+ UpdateCompletion(FALSE);
return TRUE; // eat
}
case VK_BACK:
@@ -973,21 +973,10 @@ LRESULT CAutoComplete::OnEditChar(WPARAM wParam, LPARAM lParam)
return 0; // eat
LRESULT ret = ::DefSubclassProc(m_hwndEdit, WM_CHAR, wParam, lParam); // do default
if (CanAutoSuggest() || CanAutoAppend())
- OnEditUpdate(wParam != VK_BACK);
+ UpdateCompletion(wParam != VK_BACK);
return ret;
}
-VOID CAutoComplete::OnEditUpdate(BOOL bAppendOK)
-{
- CStringW strText = GetEditText();
- if (m_strText.CompareNoCase(strText) == 0)
- {
- // no change
- return;
- }
- UpdateCompletion(bAppendOK);
-}
-
VOID CAutoComplete::OnListSelChange()
{
// update EDIT text
@@ -1508,7 +1497,8 @@ INT CAutoComplete::UpdateInnerList()
if (m_strStemText.CompareNoCase(strStemText) != 0)
{
m_strStemText = strStemText;
- bExpand = bReset = TRUE;
+ bReset = TRUE;
+ bExpand = !m_strStemText.IsEmpty();
}
// reset if necessary
@@ -1580,6 +1570,13 @@ VOID CAutoComplete::UpdateCompletion(BOOL bAppendOK)
{
TRACE("CAutoComplete::UpdateCompletion(%p, %d)\n", this, bAppendOK);
+ CStringW strText = GetEditText();
+ if (m_strText.CompareNoCase(strText) == 0)
+ {
+ // no change
+ return;
+ }
+
// update inner list
UINT cItems = UpdateInnerList();
if (cItems == 0) // no items
diff --git a/dll/win32/browseui/CAutoComplete.h b/dll/win32/browseui/CAutoComplete.h
index f779fdaf4bf..5da346ebb85 100644
--- a/dll/win32/browseui/CAutoComplete.h
+++ b/dll/win32/browseui/CAutoComplete.h
@@ -163,7 +163,6 @@ public:
LRESULT EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnEditChar(WPARAM wParam, LPARAM lParam);
BOOL OnEditKeyDown(WPARAM wParam, LPARAM lParam);
- VOID OnEditUpdate(BOOL bAppendOK);
VOID OnListSelChange();
BOOL OnListUpDown(UINT vk);