Skip to content

Commit

Permalink
Select all text when pressing Ctrl+K , Ctrl+E or Alt+D key
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Apr 26, 2022
1 parent 42dc048 commit d6881cd
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/WinWebDiffLib/WebWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<wchar_t*>(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<wchar_t*>(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);
}
Expand Down

0 comments on commit d6881cd

Please sign in to comment.