Nikolay Sivov : shell32: Use string comparison as autocompletion check.

Alexandre Julliard julliard at winehq.org
Mon Feb 6 15:17:59 CST 2012


Module: wine
Branch: master
Commit: c91e9db0cc76ce82600553ac301a2b894cb802ea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c91e9db0cc76ce82600553ac301a2b894cb802ea

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Feb  6 00:51:15 2012 +0300

shell32: Use string comparison as autocompletion check.

---

 dlls/shell32/autocomplete.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 8823262..5381f13 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -121,6 +121,9 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             }
             return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
         case WM_KEYUP:
+        {
+            int len;
+
             GetWindowTextW( hwnd, hwndText, sizeof(hwndText)/sizeof(WCHAR));
 
             switch(wParam) {
@@ -208,7 +211,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             SendMessageW(This->hwndListBox, LB_RESETCONTENT, 0, 0);
 
             HeapFree(GetProcessHeap(), 0, This->txtbackup);
-            This->txtbackup = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(hwndText)+1)*sizeof(WCHAR));
+            len = strlenW(hwndText);
+            This->txtbackup = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
             lstrcpyW(This->txtbackup, hwndText);
 
             /* Returns if there is no text to search and we doesn't want to display all the entries */
@@ -223,15 +227,14 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                 if (hr != S_OK)
                     break;
 
-                if (StrStrIW(strs, hwndText) == strs) {
+                if (!strncmpiW(hwndText, strs, len)) {
                     if (!filled && (This->options & ACO_AUTOAPPEND)) {
-                        INT typed_length = strlenW(hwndText);
                         WCHAR buffW[255];
 
                         strcpyW(buffW, hwndText);
-                        strcatW(buffW, &strs[typed_length]);
+                        strcatW(buffW, &strs[len]);
                         SetWindowTextW(hwnd, buffW);
-                        SendMessageW(hwnd, EM_SETSEL, typed_length, strlenW(strs));
+                        SendMessageW(hwnd, EM_SETSEL, len, strlenW(strs));
                         if (!(This->options & ACO_AUTOSUGGEST))
                             break;
                     }
@@ -262,6 +265,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             }
 
             break;
+        }
         case WM_DESTROY:
         {
             WNDPROC proc = This->wpOrigEditProc;




More information about the wine-cvs mailing list