Skip to content

Commit d4442b9

Browse files
committed
Enhance Ctrl-F to copy to Find What field behaviour
Fix notepad-plus-plus#16976 (comment)
1 parent cfc3fb6 commit d4442b9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,8 +4050,12 @@ void FindReplaceDlg::setSearchText(wchar_t * txt2find)
40504050
if (txt2find && txt2find[0])
40514051
{
40524052
// We got a valid search string
4053-
::SendMessage(hCombo, CB_SETCURSEL, static_cast<WPARAM>(-1), 0); // remove selection - to allow using down arrow to get to last searched word
4054-
::SetDlgItemText(_hSelf, IDFINDWHAT, txt2find);
4053+
HWND hEdit = GetWindow(hCombo, GW_CHILD);
4054+
if (hEdit)
4055+
{
4056+
::SendMessage(hEdit, EM_SETSEL, 0, static_cast<WPARAM>(-1));
4057+
::SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)txt2find);
4058+
}
40554059
}
40564060
::SendMessage(hCombo, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); // select all text - fast edit
40574061
}
@@ -4955,7 +4959,7 @@ LRESULT FAR PASCAL FindReplaceDlg::comboEditProc(HWND hwnd, UINT message, WPARAM
49554959
HWND hEdit = GetWindow(hwndCombo, GW_CHILD);
49564960
if (hEdit)
49574961
{
4958-
SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)clipboardText.c_str());
4962+
::SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)clipboardText.c_str());
49594963
}
49604964
}
49614965
}

0 commit comments

Comments
 (0)