shell32/autocomplete: Get rid of control and filled BOOLs and simplify the code.

There's no need to have filled, since cpt can already provide the same
information.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2018-09-10 22:09:35 +03:00 committed by Alexandre Julliard
parent cd8d3c6de6
commit 7f659eb5f9
1 changed files with 7 additions and 10 deletions

View File

@ -136,7 +136,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
HRESULT hr; HRESULT hr;
WCHAR hwndText[255]; WCHAR hwndText[255];
RECT r; RECT r;
BOOL control, filled, displayall = FALSE; BOOL displayall = FALSE;
int cpt, height, sel; int cpt, height, sel;
if (!This->enabled) return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam); if (!This->enabled) return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
@ -162,8 +162,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
switch(wParam) { switch(wParam) {
case VK_RETURN: case VK_RETURN:
/* If quickComplete is set and control is pressed, replace the string */ /* If quickComplete is set and control is pressed, replace the string */
control = GetKeyState(VK_CONTROL) & 0x8000; if (This->quickComplete && (GetKeyState(VK_CONTROL) & 0x8000))
if (control && This->quickComplete) { {
WCHAR *buf; WCHAR *buf;
size_t len = strlenW(hwndText); size_t len = strlenW(hwndText);
size_t sz = strlenW(This->quickComplete) + 1 + len; size_t sz = strlenW(This->quickComplete) + 1 + len;
@ -249,7 +249,6 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
break; break;
IEnumString_Reset(This->enumstr); IEnumString_Reset(This->enumstr);
filled = FALSE;
for(cpt = 0;;) { for(cpt = 0;;) {
LPOLESTR strs = NULL; LPOLESTR strs = NULL;
ULONG fetched; ULONG fetched;
@ -259,7 +258,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
break; break;
if (!strncmpiW(hwndText, strs, len)) { if (!strncmpiW(hwndText, strs, len)) {
if (!filled && (This->options & ACO_AUTOAPPEND)) { if (cpt == 0 && (This->options & ACO_AUTOAPPEND)) {
WCHAR buffW[255]; WCHAR buffW[255];
strcpyW(buffW, hwndText); strcpyW(buffW, hwndText);
@ -272,19 +271,17 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
} }
} }
if (This->options & ACO_AUTOSUGGEST) { if (This->options & ACO_AUTOSUGGEST)
SendMessageW(This->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs); SendMessageW(This->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs);
cpt++;
}
filled = TRUE; cpt++;
} }
CoTaskMemFree(strs); CoTaskMemFree(strs);
} }
if (This->options & ACO_AUTOSUGGEST) { if (This->options & ACO_AUTOSUGGEST) {
if (filled) { if (cpt) {
height = SendMessageW(This->hwndListBox, LB_GETITEMHEIGHT, 0, 0); height = SendMessageW(This->hwndListBox, LB_GETITEMHEIGHT, 0, 0);
SendMessageW(This->hwndListBox, LB_CARETOFF, 0, 0); SendMessageW(This->hwndListBox, LB_CARETOFF, 0, 0);
GetWindowRect(hwnd, &r); GetWindowRect(hwnd, &r);