[PATCH v6 1/6] shell32/autocomplete: Move the autocomplete processing and WM_KEYUP to separate functions
Huw Davies
huw at codeweavers.com
Mon Sep 17 04:59:40 CDT 2018
On Fri, Sep 14, 2018 at 02:00:31PM +0300, Gabriel Ivăncescu wrote:
> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
> ---
>
> v6: Also move WM_KEYUP to a separate function.
>
> dlls/shell32/autocomplete.c | 336 ++++++++++++++++++++++++--------------------
> 1 file changed, 182 insertions(+), 154 deletions(-)
>
> diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
> index 9f35ff7..ebbb9ee 100644
> --- a/dlls/shell32/autocomplete.c
> +++ b/dlls/shell32/autocomplete.c
> @@ -119,6 +119,76 @@ static size_t format_quick_complete(WCHAR *dst, const WCHAR *qc, const WCHAR *st
> return dst - base;
> }
>
> +static void autocomplete_text(IAutoCompleteImpl *ac, WCHAR *text, UINT len, HWND hwnd, BOOL displayall)
> +{
> + HRESULT hr;
> + UINT cpt;
> +
> + SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0);
> +
> + /* Set txtbackup to point to text itself (which must not be released) */
> + heap_free(ac->txtbackup);
> + ac->txtbackup = text;
> +
> + if (!displayall && !len)
> + return;
> +
> + IEnumString_Reset(ac->enumstr);
> + for(cpt = 0;;)
Could you please add spaces after the 'for' to be consistent with the 'if's.
> @@ -128,17 +198,122 @@ static void destroy_autocomplete_object(IAutoCompleteImpl *ac)
> }
>
> /*
> + Helper for ACEditSubclassProc
> +*/
> +static LRESULT ACEditSubclassProc_KeyUp(IAutoCompleteImpl *ac, HWND hwnd, UINT uMsg,
> + WPARAM wParam, LPARAM lParam)
> +{
> + WCHAR *text;
> + UINT len, size;
> + BOOL displayall = FALSE;
> +
> + len = SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0);
> + size = len + 1;
> + if (!(text = heap_alloc(size * sizeof(WCHAR))))
> + return 0;
> + len = SendMessageW(hwnd, WM_GETTEXT, size, (LPARAM)text);
> +
> + switch(wParam)
Likewise after the 'switch'.
Otherwsise, although this wasn't what I'd suggested, it looks ok.
Huw.
More information about the wine-devel
mailing list