@@ -23,13 +23,16 @@ INT_PTR CALLBACK FindDialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM l
23
23
// This bool is used to track which option - up or down - was used to perform the last search. That way, the next time the
24
24
// find dialog is opened, it will default to the last used option.
25
25
static bool fFindSearchUp = true ;
26
+ static std::wstring lastFindString;
27
+
26
28
WCHAR szBuf[SEARCH_STRING_LENGTH + 1 ];
27
29
switch (Message)
28
30
{
29
31
case WM_INITDIALOG:
30
32
SetWindowLongPtrW (hWnd, DWLP_USER, lParam);
31
33
SendDlgItemMessageW (hWnd, ID_CONSOLE_FINDSTR, EM_LIMITTEXT, ARRAYSIZE (szBuf) - 1 , 0 );
32
34
CheckRadioButton (hWnd, ID_CONSOLE_FINDUP, ID_CONSOLE_FINDDOWN, (fFindSearchUp ? ID_CONSOLE_FINDUP : ID_CONSOLE_FINDDOWN));
35
+ SetDlgItemText (hWnd, ID_CONSOLE_FINDSTR, lastFindString.c_str ());
33
36
return TRUE ;
34
37
case WM_COMMAND:
35
38
{
@@ -40,6 +43,7 @@ INT_PTR CALLBACK FindDialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM l
40
43
USHORT const StringLength = (USHORT)GetDlgItemTextW (hWnd, ID_CONSOLE_FINDSTR, szBuf, ARRAYSIZE (szBuf));
41
44
if (StringLength == 0 )
42
45
{
46
+ lastFindString.clear ();
43
47
break ;
44
48
}
45
49
bool const IgnoreCase = IsDlgButtonChecked (hWnd, ID_CONSOLE_FINDCASE) == 0 ;
@@ -48,7 +52,7 @@ INT_PTR CALLBACK FindDialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM l
48
52
SCREEN_INFORMATION& ScreenInfo = gci.GetActiveOutputBuffer ();
49
53
50
54
std::wstring wstr (szBuf, StringLength);
51
-
55
+ lastFindString = wstr;
52
56
LockConsole ();
53
57
auto Unlock = wil::scope_exit ([&] { UnlockConsole (); });
54
58
0 commit comments