Add ESC keystroke shortcut to close Search Results Window

Closes the focused Search Results Window by hitting ESC.

Close #2946, close #8898
This commit is contained in:
Jack Tolfree 2020-09-24 20:48:38 +01:00 committed by Don HO
parent 320aca73be
commit 174ae29f18
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
1 changed files with 3 additions and 1 deletions

View File

@ -3191,12 +3191,14 @@ void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow)
LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
if (message == WM_KEYDOWN && (wParam == VK_DELETE || wParam == VK_RETURN)) if (message == WM_KEYDOWN && (wParam == VK_DELETE || wParam == VK_RETURN || wParam == VK_ESCAPE))
{ {
ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
Finder *pFinder = (Finder *)(::GetWindowLongPtr(pScint->getHParent(), GWLP_USERDATA)); Finder *pFinder = (Finder *)(::GetWindowLongPtr(pScint->getHParent(), GWLP_USERDATA));
if (wParam == VK_RETURN) if (wParam == VK_RETURN)
pFinder->gotoFoundLine(); pFinder->gotoFoundLine();
else if (wParam == VK_ESCAPE)
::SendMessage(::GetParent(pFinder->getHParent()), NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(pFinder->getHSelf()));
else // VK_DELETE else // VK_DELETE
pFinder->deleteResult(); pFinder->deleteResult();
return 0; return 0;