Nikolay Sivov : shell32/autocomplete: Really append suggested part instead of replacing whole string.

Alexandre Julliard julliard at winehq.org
Mon Jul 25 11:43:13 CDT 2011


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jul 24 22:42:25 2011 +0400

shell32/autocomplete: Really append suggested part instead of replacing whole string.

---

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

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index fa80713..2c59207 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -486,7 +486,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
 	    }
 	    return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
 	case WM_KEYUP:
-            GetWindowTextW( hwnd, hwndText, 255);
+            GetWindowTextW( hwnd, hwndText, sizeof(hwndText)/sizeof(WCHAR));
 
 	    switch(wParam) {
 		case VK_RETURN:
@@ -591,11 +591,16 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
 
 		if (StrStrIW(strs, hwndText) == strs) {
                     if (!filled && (This->options & ACO_AUTOAPPEND)) {
-			SetWindowTextW(hwnd, strs);
-			SendMessageW(hwnd, EM_SETSEL, lstrlenW(hwndText), lstrlenW(strs));
+                        INT typed_length = strlenW(hwndText);
+                        WCHAR buffW[255];
+
+                        strcpyW(buffW, hwndText);
+                        strcatW(buffW, &strs[typed_length]);
+                        SetWindowTextW(hwnd, buffW);
+                        SendMessageW(hwnd, EM_SETSEL, typed_length, strlenW(strs));
                         if (!(This->options & ACO_AUTOSUGGEST))
                             break;
-		    }		
+                    }
 
 		    if (This->options & ACO_AUTOSUGGEST) {
 			SendMessageW(This->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs);




More information about the wine-cvs mailing list