Skip to content

Find dialog flickers when Select and Find Next (Ctrl+F3) is pressed first time #9536

@d0vgan

Description

@d0vgan

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

  1. Start Notepad++
  2. Press Ctrl+F3 - the Find dialog flickers
  3. 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").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions