[PATCH 02/17] shell32/autocomplete: Fix handling of Backspace and Delete so that it matches Windows

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


On Windows, auto-append doesn't happen when the user presses Backspace or
Delete, so remove it (not to mention it's totally wrong and full of bugs,
see Wine-Bug). However, the autocompletion box does show up for these two
keys, so handle that.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22255
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

That being said, the previous code was completely wrong even if auto
append actually worked on Backspace or Delete. I honestly have no idea
what it tried to accomplish... (not to mention it happens on a WM_KEYUP,
which means the control already processed the operation itself)

Behavior compared with Windows XP SP2.

 dlls/shell32/autocomplete.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 051644a..254884b 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -199,16 +199,6 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                         ShowWindow(This->hwndListBox, SW_HIDE);
                         return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
                     }
-                    if (This->options & ACO_AUTOAPPEND) {
-                        DWORD b;
-                        SendMessageW(hwnd, EM_GETSEL, (WPARAM)&b, 0);
-                        if (b>1) {
-                            hwndText[b-1] = '\0';
-                        } else {
-                            hwndText[0] = '\0';
-                            SetWindowTextW(hwnd, hwndText);
-                        }
-                    }
                     break;
                 default:
                     ;
@@ -236,7 +226,9 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                     break;
 
                 if (!strncmpiW(hwndText, strs, len)) {
-                    if (!filled && (This->options & ACO_AUTOAPPEND)) {
+                    if (!filled && (This->options & ACO_AUTOAPPEND) &&
+                        wParam != VK_BACK && wParam != VK_DELETE)
+                    {
                         WCHAR buffW[255];
 
                         strcpyW(buffW, hwndText);
-- 
1.9.1




More information about the wine-devel mailing list