On Wed, Sep 05, 2018 at 07:13:04PM +0300, Gabriel Ivăncescu wrote:
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@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);
}
}
Right, the original code here is clearly broken.
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)
{
Special casing VK_BACK and VK_DELETE like this looks odd. There has to be a cleaner way. I'm also concerned that you're about to rip this code apart in [7/17].
WCHAR buffW[255]; strcpyW(buffW, hwndText);
-- 1.9.1