From d6881cdb57f3d1432913da920c965986d06da9b7 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Tue, 26 Apr 2022 23:37:45 +0900 Subject: [PATCH] Select all text when pressing Ctrl+K , Ctrl+E or Alt+D key --- src/WinWebDiffLib/WebWindow.hpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/WinWebDiffLib/WebWindow.hpp b/src/WinWebDiffLib/WebWindow.hpp index 7c428d6..3371876 100644 --- a/src/WinWebDiffLib/WebWindow.hpp +++ b/src/WinWebDiffLib/WebWindow.hpp @@ -1598,14 +1598,27 @@ class CWebWindow LRESULT OnEditWndMsg(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { - if (iMsg == WM_CHAR && wParam == VK_RETURN && hWnd == m_hEdit) + if (hWnd == m_hEdit) { - int length = GetWindowTextLength(m_hEdit); - std::wstring url(length, 0); - GetWindowText(m_hEdit, const_cast(url.data()), length + 1); - SetFocus(); - Navigate(url); - return 0; + if (iMsg == WM_CHAR && wParam == VK_RETURN) + { + int length = GetWindowTextLength(m_hEdit); + std::wstring url(length, 0); + GetWindowText(m_hEdit, const_cast(url.data()), length + 1); + SetFocus(); + Navigate(url); + return 0; + } + else if (iMsg == WM_KEYDOWN || iMsg == WM_SYSKEYDOWN) + { + short vkctrl = GetAsyncKeyState(VK_CONTROL); + short vkmenu = GetAsyncKeyState(VK_MENU); + if ((vkctrl && wParam == 'E' || wParam == 'K') || (vkmenu && wParam == 'D')) + { + SendMessage(m_hEdit, EM_SETSEL, 0, -1); + return 0; + } + } } return CallWindowProc(m_oldEditWndProc, hWnd, iMsg, wParam, lParam); }