Skip to content

Commit d6881cd

Browse files
committed
Select all text when pressing Ctrl+K , Ctrl+E or Alt+D key
1 parent 42dc048 commit d6881cd

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/WinWebDiffLib/WebWindow.hpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,14 +1598,27 @@ class CWebWindow
15981598

15991599
LRESULT OnEditWndMsg(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
16001600
{
1601-
if (iMsg == WM_CHAR && wParam == VK_RETURN && hWnd == m_hEdit)
1601+
if (hWnd == m_hEdit)
16021602
{
1603-
int length = GetWindowTextLength(m_hEdit);
1604-
std::wstring url(length, 0);
1605-
GetWindowText(m_hEdit, const_cast<wchar_t*>(url.data()), length + 1);
1606-
SetFocus();
1607-
Navigate(url);
1608-
return 0;
1603+
if (iMsg == WM_CHAR && wParam == VK_RETURN)
1604+
{
1605+
int length = GetWindowTextLength(m_hEdit);
1606+
std::wstring url(length, 0);
1607+
GetWindowText(m_hEdit, const_cast<wchar_t*>(url.data()), length + 1);
1608+
SetFocus();
1609+
Navigate(url);
1610+
return 0;
1611+
}
1612+
else if (iMsg == WM_KEYDOWN || iMsg == WM_SYSKEYDOWN)
1613+
{
1614+
short vkctrl = GetAsyncKeyState(VK_CONTROL);
1615+
short vkmenu = GetAsyncKeyState(VK_MENU);
1616+
if ((vkctrl && wParam == 'E' || wParam == 'K') || (vkmenu && wParam == 'D'))
1617+
{
1618+
SendMessage(m_hEdit, EM_SETSEL, 0, -1);
1619+
return 0;
1620+
}
1621+
}
16091622
}
16101623
return CallWindowProc(m_oldEditWndProc, hWnd, iMsg, wParam, lParam);
16111624
}

0 commit comments

Comments
 (0)