[PATCH 13/17] shell32/autocomplete: Don't auto-append unless the caret is at the end

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


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

This matches Windows behavior and gets rid of annoying caret movement.

 dlls/shell32/autocomplete.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 449e8a4..9bc617b 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -308,7 +308,13 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                     break;
 
                 if (!strncmpiW(hwndText, strs, len)) {
-                    if (cpt == 0 && noautoappend == FALSE)
+                    DWORD sel_start;
+
+                    /* Don't auto-append unless the caret is at the end */
+                    if (cpt == 0 && noautoappend == FALSE
+                        && (CallWindowProcW(edit_proc, hwnd, EM_GETSEL, (WPARAM)&sel_start, 0),
+                            sel_start == len)
+                       )
                     {
                         /* The character capitalization can be different,
                            so merge hwndText and strs into a new string */
-- 
1.9.1




More information about the wine-devel mailing list