Skip to content

Commit cfc3fb6

Browse files
committed
Improve copy multilines to comboboxs behaviour in Find Replace Dialog
Fix notepad-plus-plus#16952 (comment) Close notepad-plus-plus#16976
1 parent 5c6f89d commit cfc3fb6

1 file changed

Lines changed: 3 additions & 19 deletions

File tree

PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4952,26 +4952,10 @@ LRESULT FAR PASCAL FindReplaceDlg::comboEditProc(HWND hwnd, UINT message, WPARAM
49524952
wstring clipboardText = strFromClipboard();
49534953
if (!clipboardText.empty())
49544954
{
4955-
wstring origText = getTextFromCombo(hwndCombo);
4956-
4957-
DWORD selStartIndex = 0;
4958-
DWORD selEndIndex = 0;
4959-
// In case there are selected text in combo box field
4960-
::SendMessage(hwndCombo, CB_GETEDITSEL, (WPARAM)&selStartIndex, (LPARAM)&selEndIndex);
4961-
4962-
wstring changedText = origText.substr(0, selStartIndex) + clipboardText + origText.substr(selEndIndex);
4963-
if (changedText.length() > FINDREPLACE_MAXLENGTH - 1)
4964-
{
4965-
changedText = changedText.substr(0, FINDREPLACE_MAXLENGTH - 1);
4966-
}
4967-
4968-
if (changedText != origText)
4955+
HWND hEdit = GetWindow(hwndCombo, GW_CHILD);
4956+
if (hEdit)
49694957
{
4970-
::SendMessage(hwndCombo, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(changedText.c_str()));
4971-
4972-
::SendMessage(hParent, WM_COMMAND,
4973-
MAKELPARAM(hwndCombo == hFindWhatCombo ? IDFINDWHAT : IDREPLACEWITH, CBN_EDITUPDATE),
4974-
reinterpret_cast<LPARAM>(hwndCombo));
4958+
SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)clipboardText.c_str());
49754959
}
49764960
}
49774961
}

0 commit comments

Comments
 (0)