[PATCH v2 4/8] shell32/autocomplete: Don't auto-append unless the caret is at the end

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Sep 25 06:55:30 CDT 2018


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

This gets rid of annoying caret movement when replacing a selection that's
not at the end (so it matches Windows).

 dlls/shell32/autocomplete.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index a681655..243ccba 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -136,9 +136,15 @@ static size_t format_quick_complete(WCHAR *dst, const WCHAR *qc, const WCHAR *st
 
 static void autoappend_str(IAutoCompleteImpl *ac, WCHAR *text, UINT len, WCHAR *str, HWND hwnd)
 {
+    DWORD sel_start;
     WCHAR *tmp;
     size_t size;
 
+    /* Don't auto-append unless the caret is at the end */
+    SendMessageW(hwnd, EM_GETSEL, (WPARAM)&sel_start, 0);
+    if (sel_start != len)
+        return;
+
     /* The character capitalization can be different,
        so merge text and str into a new string */
     size = len + strlenW(&str[len]) + 1;
-- 
1.9.1




More information about the wine-devel mailing list