[PATCH 08/17] shell32/autocomplete: Fix going up through the AutoComplete listbox

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Sep 5 11:13:10 CDT 2018


When going up past the topmost item in the listbox, go through txtbackup
first before wrapping around, just like when going down. This matches
Windows behavior.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/shell32/autocomplete.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 74728e0..4305f65 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -183,14 +183,12 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                                 goto autocomplete_text;
                             }
                         } else {
-                            INT count;
-
-                            count = SendMessageW(This->hwndListBox, LB_GETCOUNT, 0, 0);
+                            INT count = SendMessageW(This->hwndListBox, LB_GETCOUNT, 0, 0);
 
                             /* Change the selection */
                             sel = SendMessageW(This->hwndListBox, LB_GETCURSEL, 0, 0);
                             if (wParam == VK_UP)
-                                sel = ((sel-1) < 0) ? count-1 : sel-1;
+                                sel = ((sel-1) < -1) ? count-1 : sel-1;
                             else
                                 sel = ((sel+1) >= count) ? -1 : sel+1;
                             SendMessageW(This->hwndListBox, LB_SETCURSEL, sel, 0);
-- 
1.9.1




More information about the wine-devel mailing list