mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ chg: Open FInd/Replace: use most recent find pattern instead of clipboard (if selection is empty)
This commit is contained in:
parent
eb8c6c8ddf
commit
057165ec14
25
src/Edit.c
25
src/Edit.c
@ -5261,16 +5261,23 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
|
||||
}
|
||||
else if (cchSelection <= 1) {
|
||||
// nothing is selected in the editor:
|
||||
// if first time you bring up find/replace dialog,
|
||||
// copy content clipboard to find box
|
||||
char* pClip = EditGetClipboardText(hwnd, false, NULL, NULL);
|
||||
if (pClip) {
|
||||
size_t const len = StringCchLenA(pClip,0);
|
||||
if (len) {
|
||||
lpszSelection = AllocMem(len + 1, HEAP_ZERO_MEMORY);
|
||||
StringCchCopyNA(lpszSelection, len + 1, pClip, len);
|
||||
// if first time you bring up find/replace dialog,
|
||||
// use most recent search pattern to find box
|
||||
GetFindPattern(tchBuf, FNDRPL_BUFFER);
|
||||
if (tchBuf[0] == L'\0') {
|
||||
MRU_Enum(Globals.pMRUfind, 0, tchBuf, COUNTOF(tchBuf));
|
||||
}
|
||||
// no recent find pattern: copy content clipboard to find box
|
||||
if (tchBuf[0] == L'\0') {
|
||||
char* pClip = EditGetClipboardText(hwnd, false, NULL, NULL);
|
||||
if (pClip) {
|
||||
size_t const len = StringCchLenA(pClip, 0);
|
||||
if (len) {
|
||||
lpszSelection = AllocMem(len + 1, HEAP_ZERO_MEMORY);
|
||||
StringCchCopyNA(lpszSelection, len + 1, pClip, len);
|
||||
}
|
||||
FreeMem(pClip);
|
||||
}
|
||||
FreeMem(pClip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ typedef enum
|
||||
XXXL_BUFFER = 4096,
|
||||
|
||||
ANSI_CHAR_BUFFER = 258,
|
||||
FNDRPL_BUFFER = 1024,
|
||||
FNDRPL_BUFFER = 2048,
|
||||
LONG_LINES_MARKER_LIMIT = 4096
|
||||
|
||||
} BUFFER_SIZES;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user