Commit 7ac4c0ea authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

shell32/autocomplete: Retrieve the count in show_listbox.

parent e7fd1ac3
...@@ -193,15 +193,16 @@ static void hide_listbox(IAutoCompleteImpl *ac, HWND hwnd, BOOL reset) ...@@ -193,15 +193,16 @@ static void hide_listbox(IAutoCompleteImpl *ac, HWND hwnd, BOOL reset)
if (reset) free_enum_strs(ac); if (reset) free_enum_strs(ac);
} }
static void show_listbox(IAutoCompleteImpl *ac, UINT cnt) static void show_listbox(IAutoCompleteImpl *ac)
{ {
RECT r; RECT r;
UINT width, height; UINT cnt, width, height;
GetWindowRect(ac->hwndEdit, &r); GetWindowRect(ac->hwndEdit, &r);
SendMessageW(ac->hwndListBox, LB_CARETOFF, 0, 0); SendMessageW(ac->hwndListBox, LB_CARETOFF, 0, 0);
/* Windows XP displays 7 lines at most, then it uses a scroll bar */ /* Windows XP displays 7 lines at most, then it uses a scroll bar */
cnt = SendMessageW(ac->hwndListBox, LB_GETCOUNT, 0, 0);
height = SendMessageW(ac->hwndListBox, LB_GETITEMHEIGHT, 0, 0) * min(cnt + 1, 7); height = SendMessageW(ac->hwndListBox, LB_GETITEMHEIGHT, 0, 0) * min(cnt + 1, 7);
width = r.right - r.left; width = r.right - r.left;
...@@ -404,7 +405,7 @@ static BOOL display_matching_strs(IAutoCompleteImpl *ac, WCHAR *text, UINT len, ...@@ -404,7 +405,7 @@ static BOOL display_matching_strs(IAutoCompleteImpl *ac, WCHAR *text, UINT len,
{ {
/* Return FALSE if we need to hide the listbox */ /* Return FALSE if we need to hide the listbox */
WCHAR **str = ac->enum_strs; WCHAR **str = ac->enum_strs;
UINT cnt, start, end; UINT start, end;
if (!str) return (ac->options & ACO_AUTOSUGGEST) ? FALSE : TRUE; if (!str) return (ac->options & ACO_AUTOSUGGEST) ? FALSE : TRUE;
/* Windows seems to disable autoappend if ACO_NOPREFIXFILTERING is set */ /* Windows seems to disable autoappend if ACO_NOPREFIXFILTERING is set */
...@@ -432,15 +433,14 @@ static BOOL display_matching_strs(IAutoCompleteImpl *ac, WCHAR *text, UINT len, ...@@ -432,15 +433,14 @@ static BOOL display_matching_strs(IAutoCompleteImpl *ac, WCHAR *text, UINT len,
if (end == 0) if (end == 0)
return FALSE; return FALSE;
} }
cnt = end - start;
SendMessageW(ac->hwndListBox, WM_SETREDRAW, FALSE, 0); SendMessageW(ac->hwndListBox, WM_SETREDRAW, FALSE, 0);
SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0); SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0);
SendMessageW(ac->hwndListBox, LB_INITSTORAGE, cnt, 0); SendMessageW(ac->hwndListBox, LB_INITSTORAGE, end - start, 0);
for (; start < end; start++) for (; start < end; start++)
SendMessageW(ac->hwndListBox, LB_INSERTSTRING, -1, (LPARAM)str[start]); SendMessageW(ac->hwndListBox, LB_INSERTSTRING, -1, (LPARAM)str[start]);
show_listbox(ac, cnt); show_listbox(ac);
SendMessageW(ac->hwndListBox, WM_SETREDRAW, TRUE, 0); SendMessageW(ac->hwndListBox, WM_SETREDRAW, TRUE, 0);
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment