Merge pull request #3120 from RaiKoHoff/Dev_Release

F/R-Dialog - allow multi-line clipboard paste to Replace String combobox too
This commit is contained in:
Pairi Daiza 2021-02-19 12:47:41 +01:00 committed by GitHub
commit ba2b268484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5596,16 +5596,15 @@ static bool s_SaveMarkMatchVisible = false;
// EditBoxForPasteFixes()
//
static LRESULT CALLBACK EditBoxForPasteFixes(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
LPEDITFINDREPLACE pefrData = (LPEDITFINDREPLACE)dwRefData;
WCHAR* const s_wchBuffer = (WCHAR*)dwRefData;
if (pefrData) {
if (s_wchBuffer) {
switch (uMsg) {
case WM_PASTE: {
WCHAR wchBuf[FNDRPL_BUFFER] = { L'\0' }; // tmp working buffer
EditGetClipboardW(wchBuf, COUNTOF(wchBuf));
SendMessage(hwnd, EM_REPLACESEL, (WPARAM)TRUE, (LPARAM)wchBuf);
EditGetClipboardW(s_wchBuffer, FNDRPL_BUFFER);
SendMessage(hwnd, EM_REPLACESEL, (WPARAM)TRUE, (LPARAM)s_wchBuffer);
}
return TRUE;
@ -5723,10 +5722,6 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
MRU_Enum(Globals.pMRUfind, i, s_tchBuf, COUNTOF(s_tchBuf));
SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_ADDSTRING, 0, (LPARAM)s_tchBuf);
}
for (int i = 0; i < MRU_Count(Globals.pMRUreplace); i++) {
MRU_Enum(Globals.pMRUreplace, i, s_tchBuf, COUNTOF(s_tchBuf));
SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_ADDSTRING, 0, (LPARAM)s_tchBuf);
}
SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_LIMITTEXT, FNDRPL_BUFFER, 0);
SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_SETEXTENDEDUI, true, 0);
@ -5734,7 +5729,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
COMBOBOXINFO cbInfoF = { sizeof(COMBOBOXINFO) };
GetComboBoxInfo(GetDlgItem(hwnd, IDC_FINDTEXT), &cbInfoF);
if (cbInfoF.hwndItem) {
SetWindowSubclass(cbInfoF.hwndItem, EditBoxForPasteFixes, 0, (DWORD_PTR)s_pEfrDataDlg);
SetWindowSubclass(cbInfoF.hwndItem, EditBoxForPasteFixes, 0, (DWORD_PTR) &(s_tchBuf[0]));
SHAutoComplete(cbInfoF.hwndItem, SHACF_FILESYS_ONLY | SHACF_AUTOAPPEND_FORCE_OFF | SHACF_AUTOSUGGEST_FORCE_OFF);
}
@ -5745,13 +5740,20 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
}
if (GetDlgItem(hwnd, IDC_REPLACETEXT)) {
// Load MRUs
for (int i = 0; i < MRU_Count(Globals.pMRUreplace); i++) {
MRU_Enum(Globals.pMRUreplace, i, s_tchBuf, COUNTOF(s_tchBuf));
SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_ADDSTRING, 0, (LPARAM)s_tchBuf);
}
SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_LIMITTEXT, FNDRPL_BUFFER, 0);
SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_SETEXTENDEDUI, true, 0);
COMBOBOXINFO cbInfoR = { sizeof(COMBOBOXINFO) };
GetComboBoxInfo(GetDlgItem(hwnd, IDC_REPLACETEXT), &cbInfoR);
if (cbInfoR.hwndItem) {
SetWindowSubclass(cbInfoR.hwndItem, EditBoxForPasteFixes, 0, 0);
SetWindowSubclass(cbInfoR.hwndItem, EditBoxForPasteFixes, 0, (DWORD_PTR) &(s_tchBuf[0]));
SHAutoComplete(cbInfoR.hwndItem, SHACF_FILESYS_ONLY | SHACF_AUTOAPPEND_FORCE_OFF | SHACF_AUTOSUGGEST_FORCE_OFF);
}