-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Description of the Issue
When Notepad++ is started and Select and Find Next (Ctrl+F3) is pressed for the first time, the Find dialog flickers.
Steps to Reproduce the Issue
- Start Notepad++
- Press Ctrl+F3 - the Find dialog flickers
- To reproduce it better, open the source file "PowerEditor\src\ScintillaComponent\FindReplaceDlg.cpp", find the method "FindReplaceDlg::create", add
::Sleep(1000);right after the line::SetWindowPos(_hSelf, HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);and rebuild Notepad++.
Expected Behavior
As Ctrl+F3 performs a "silent search" for a given word, no flickering is expected.
Actual Behavior
The Find dialogs flickers.
One of possible ways to fix this issue is to extract the
NppParameters& nppParam = NppParameters::getInstance();
NppGUI& nppGUI = const_cast<NppGUI&>(nppParam.getNppGUI());
if (nppGUI._findWindowPos.bottom - nppGUI._findWindowPos.top != 0) // check height against 0 as a test of valid data from config
{
RECT rc = getViewablePositionRect(nppGUI._findWindowPos);
::SetWindowPos(_hSelf, HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
//Sleep(1000);
}
else
{
goToCenter();
}
into a separate method that is called only when toShow is true.
Such approach, however, adds another problem: the keyboard focus is for some reason "stolen" from Scintilla and does not return back to it. According to my investigations, the focus is "stolen" as the result of calling _hSelf = ::CreateDialogParam(_hInst, MAKEINTRESOURCE(dialogID), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)); within "StaticDialog::create" (this one is called from the "FindReplaceDlg::create").