diff --git a/scintilla/lexers/LexRegistry.cxx b/scintilla/lexers/LexRegistry.cxx
index 899d9604c..015a9bc7e 100644
--- a/scintilla/lexers/LexRegistry.cxx
+++ b/scintilla/lexers/LexRegistry.cxx
@@ -368,9 +368,6 @@ void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos,
if (setOperators.Contains(context.ch) && highlight) {
context.SetState(SCE_REG_OPERATOR);
}
- //if (context.chPrev == ']' && !IsNextNonWhitespace(styler, currPos - 1, ';')) {
- // context.SetState(stateLastNonDefault); // continue Reg-Key style for eolfilled
- //}
// continue style for eolfilled
if (context.ch == '\r' || context.ch == '\n') {
context.SetState(stateLastNonDefault);
diff --git a/src/Edit.c b/src/Edit.c
index c0feb6c7c..da815a9d4 100644
--- a/src/Edit.c
+++ b/src/Edit.c
@@ -86,6 +86,7 @@ extern BOOL bLoadNFOasOEM;
extern BOOL bAccelWordNavigation;
+extern int iReplacedOccurrences;
extern int iMarkOccurrences;
extern int iMarkOccurrencesCount;
extern int iMarkOccurrencesMaxCount;
@@ -4594,6 +4595,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
case WM_INITDIALOG:
{
static BOOL bFirstTime = TRUE;
+ iReplacedOccurrences = 0;
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
lpefr = (LPEDITFINDREPLACE)lParam;
@@ -4808,6 +4810,8 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
bMarkOccurrencesMatchVisible = bSaveOccVisible;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible);
+ iReplacedOccurrences = 0;
+
KillTimer(hwnd, IDT_TIMER_MRKALL);
}
return FALSE;
@@ -4910,6 +4914,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
// called on timer trigger
case IDC_MARKALL_OCC:
{
+ iMarkOccurrencesCount = 0;
EditSetSearchFlags(hwnd, lpefr);
if (lpefr->bMarkOccurences) {
if (bFlagsChanged || (StringCchCompareXA(g_lastFind, lpefr->szFind) != 0)) {
@@ -5033,11 +5038,13 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditSetTimerMarkAll(hwnd,0);
break;
+
case IDOK:
- case IDC_FINDPREV:
case IDC_REPLACE:
case IDC_REPLACEALL:
case IDC_REPLACEINSEL:
+ iReplacedOccurrences = 0;
+ case IDC_FINDPREV:
case IDACC_SELTONEXT:
case IDACC_SELTOPREV:
case IDMSG_SWITCHTOFIND:
@@ -5339,12 +5346,8 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
//
HWND EditFindReplaceDlg(HWND hwnd,LPCEDITFINDREPLACE lpefr,BOOL bReplace)
{
-
- HWND hDlg;
-
lpefr->hwnd = hwnd;
-
- hDlg = CreateThemedDialogParam(g_hInstance,
+ HWND hDlg = CreateThemedDialogParam(g_hInstance,
(bReplace) ? MAKEINTRESOURCEW(IDD_REPLACE) : MAKEINTRESOURCEW(IDD_FIND),
GetParent(hwnd),
EditFindReplaceDlgProcW,
@@ -5595,6 +5598,7 @@ BOOL EditReplace(HWND hwnd, LPCEDITFINDREPLACE lpefr) {
DocPos start = (SciCall_IsSelectionEmpty() ? SciCall_GetCurrentPos() : SciCall_GetSelectionStart());
DocPos end = SciCall_GetTextLength();
DocPos _start = start;
+ iReplacedOccurrences = 0;
DocPos iPos = EditFindInTarget(hwnd, lpefr->szFind, StringCchLenA(lpefr->szFind, FNDRPL_BUFFER), (int)(lpefr->fuFlags), &start, &end, FALSE);
@@ -5612,6 +5616,7 @@ BOOL EditReplace(HWND hwnd, LPCEDITFINDREPLACE lpefr) {
}
}
}
+ iReplacedOccurrences = 1;
EditEnterTargetTransaction();
@@ -5753,11 +5758,11 @@ BOOL EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo)
int token = BeginUndoAction();
- int iCount = EditReplaceAllInRange(hwnd, lpefr, bShowInfo, start, end);
+ iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, bShowInfo, start, end);
EndUndoAction(token);
- return (iCount > 0) ? TRUE : FALSE;
+ return (iReplacedOccurrences > 0) ? TRUE : FALSE;
}
@@ -5777,11 +5782,11 @@ BOOL EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowIn
int token = BeginUndoAction();
- int iCount = EditReplaceAllInRange(hwnd, lpefr, bShowInfo, start, end);
+ iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, bShowInfo, start, end);
EndUndoAction(token);
- if (iCount <= 0)
+ if (iReplacedOccurrences <= 0)
return FALSE;
return TRUE;
diff --git a/src/Notepad3.c b/src/Notepad3.c
index a5eacd513..cd4c4df2f 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -57,10 +57,10 @@ HWND g_hwndMain = NULL;
HWND g_hwndEdit = NULL;
HWND g_hwndStatus = NULL;
HWND g_hwndToolbar = NULL;
+HWND g_hwndDlgFindReplace = NULL;
HWND hwndReBar = NULL;
HWND hwndEditFrame = NULL;
HWND hwndNextCBChain = NULL;
-HWND hDlgFindReplace = NULL;
#define INISECTIONBUFCNT 32
#define NUMTOOLBITMAPS 25
@@ -156,6 +156,7 @@ int iLongLineMode;
int iWrapCol = 0;
BOOL g_bShowSelectionMargin;
BOOL bShowLineNumbers;
+int iReplacedOccurrences;
int iMarkOccurrences;
int iMarkOccurrencesCount;
int iMarkOccurrencesMaxCount;
@@ -541,10 +542,10 @@ int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int n
while (GetMessage(&msg,NULL,0,0))
{
- if (IsWindow(hDlgFindReplace) && ((msg.hwnd == hDlgFindReplace) || IsChild(hDlgFindReplace, msg.hwnd)))
+ if (IsWindow(g_hwndDlgFindReplace) && ((msg.hwnd == g_hwndDlgFindReplace) || IsChild(g_hwndDlgFindReplace, msg.hwnd)))
{
- int iTr = TranslateAccelerator(hDlgFindReplace, hAccFindReplace, &msg);
- if (iTr || IsDialogMessage(hDlgFindReplace, &msg))
+ int iTr = TranslateAccelerator(g_hwndDlgFindReplace, hAccFindReplace, &msg);
+ if (iTr || IsDialogMessage(g_hwndDlgFindReplace, &msg))
continue;
}
if (!TranslateAccelerator(hwnd,hAccMain,&msg)) {
@@ -900,6 +901,7 @@ HWND InitInstance(HINSTANCE hInstance,LPSTR pszCmdLine,int nCmdShow)
if (flagStartAsTrayIcon)
SetNotifyIconTitle(g_hwndMain);
+ iReplacedOccurrences = 0;
iMarkOccurrencesCount = 0;
UpdateToolbar();
UpdateStatusbar();
@@ -1526,8 +1528,8 @@ void MsgEndSession(HWND hwnd, UINT umsg)
}
// Destroy find / replace dialog
- if (IsWindow(hDlgFindReplace))
- DestroyWindow(hDlgFindReplace);
+ if (IsWindow(g_hwndDlgFindReplace))
+ DestroyWindow(g_hwndDlgFindReplace);
// call SaveSettings() when g_hwndToolbar is still valid
SaveSettings(FALSE);
@@ -3658,35 +3660,37 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_FIND:
- if (!IsWindow(hDlgFindReplace))
- hDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,FALSE);
+ if (!IsWindow(g_hwndDlgFindReplace))
+ g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,FALSE);
else {
- if (GetDlgItem(hDlgFindReplace,IDC_REPLACE)) {
- SendMessage(hDlgFindReplace,WM_COMMAND,MAKELONG(IDMSG_SWITCHTOFIND,1),0);
- DestroyWindow(hDlgFindReplace);
- hDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,FALSE);
+ if (GetDlgItem(g_hwndDlgFindReplace,IDC_REPLACE)) {
+ SendMessage(g_hwndDlgFindReplace,WM_COMMAND,MAKELONG(IDMSG_SWITCHTOFIND,1),0);
+ DestroyWindow(g_hwndDlgFindReplace);
+ g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,FALSE);
}
else {
- SetForegroundWindow(hDlgFindReplace);
- PostMessage(hDlgFindReplace,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hDlgFindReplace,IDC_FINDTEXT)),1);
+ SetForegroundWindow(g_hwndDlgFindReplace);
+ PostMessage(g_hwndDlgFindReplace,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(g_hwndDlgFindReplace,IDC_FINDTEXT)),1);
}
+ UpdateStatusbar();
}
break;
case IDM_EDIT_REPLACE:
- if (!IsWindow(hDlgFindReplace))
- hDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,TRUE);
+ if (!IsWindow(g_hwndDlgFindReplace))
+ g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,TRUE);
else {
- if (!GetDlgItem(hDlgFindReplace,IDC_REPLACE)) {
- SendMessage(hDlgFindReplace,WM_COMMAND,MAKELONG(IDMSG_SWITCHTOREPLACE,1),0);
- DestroyWindow(hDlgFindReplace);
- hDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,TRUE);
+ if (!GetDlgItem(g_hwndDlgFindReplace,IDC_REPLACE)) {
+ SendMessage(g_hwndDlgFindReplace,WM_COMMAND,MAKELONG(IDMSG_SWITCHTOREPLACE,1),0);
+ DestroyWindow(g_hwndDlgFindReplace);
+ g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit,&g_efrData,TRUE);
}
else {
- SetForegroundWindow(hDlgFindReplace);
- PostMessage(hDlgFindReplace,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hDlgFindReplace,IDC_FINDTEXT)),1);
+ SetForegroundWindow(g_hwndDlgFindReplace);
+ PostMessage(g_hwndDlgFindReplace,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(g_hwndDlgFindReplace,IDC_FINDTEXT)),1);
}
+ UpdateStatusbar();
}
break;
@@ -6957,7 +6961,9 @@ void UpdateStatusbar()
static WCHAR tchSel[32] = { L'\0' };
static WCHAR tchSelB[32] = { L'\0' };
static WCHAR tchOcc[32] = { L'\0' };
- static WCHAR tchDocPos[256] = { L'\0' };
+ static WCHAR tchReplOccs[32] = { L'\0' };
+ static WCHAR tchDocPos[128] = { L'\0' };
+ static WCHAR tchFRStatus[128] = { L'\0' };
static WCHAR tchBytes[64] = { L'\0' };
static WCHAR tchDocSize[64] = { L'\0' };
@@ -7050,6 +7056,17 @@ void UpdateStatusbar()
else {
FormatString(tchDocPos, COUNTOF(tchDocPos), IDS_DOCPOS2, tchLn, tchLines, tchCol, tchCols, tchSel, tchSelB, tchLinesSelected, tchOcc);
}
+
+ // update Find/Replace dialog (if any)
+ if (g_hwndDlgFindReplace) {
+ if (iReplacedOccurrences > 0)
+ StringCchPrintf(tchReplOccs, COUNTOF(tchReplOccs), L"%i", iReplacedOccurrences);
+ else
+ StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--");
+
+ FormatString(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT, tchLn, tchLines, tchCol, tchSel, tchOcc, tchReplOccs);
+ SetWindowText(GetDlgItem(g_hwndDlgFindReplace, IDS_FR_STATUS_TEXT), tchFRStatus);
+ }
// get number of bytes in current encoding
StrFormatByteSize(iTextLength, tchBytes, COUNTOF(tchBytes));
diff --git a/src/Notepad3.rc b/src/Notepad3.rc
index abab5822f..465bbe359 100644
--- a/src/Notepad3.rc
+++ b/src/Notepad3.rc
@@ -652,7 +652,7 @@ BEGIN
LTEXT "Contributors: Derick Payne (Rizonesoft), Flo Balmer (Notepad2), N.Hodgson (Scintilla), XhmikosR (Notepad2-mod), Kai Liu, RL Vision, A.Lekov, B.Barbieri, M.Ellis (MinimizeToTray), D.Dyer (crypt), T.D.Hanson (uthash), RaiKoHoff",IDC_STATIC,45,150,200,44
END
-IDD_FIND DIALOGEX 0, 0, 273, 120
+IDD_FIND DIALOGEX 0, 0, 273, 129
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find Text"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
@@ -673,13 +673,14 @@ BEGIN
PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14
PUSHBUTTON "Close",IDCANCEL,212,99,54,14
CONTROL "Goto Replace (Ctrl+H)",IDC_TOGGLEFINDREPLACE,
- "SysLink",0x0,125,104,74,10
+ "SysLink",0x0,125,103,74,10
CONTROL "(?)",IDC_REGEXPHELP,"SysLink",0x0,106,85,14,10
CONTROL "(?)",IDC_BACKSLASHHELP,"SysLink",0x0,106,73,14,10
CONTROL "(?)",IDC_WILDCARDHELP,"SysLink",0x0,191,85,14,10
+ CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,117,259,9,WS_EX_STATICEDGE
END
-IDD_REPLACE DIALOGEX 0, 0, 273, 147
+IDD_REPLACE DIALOGEX 0, 0, 273, 156
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Replace Text"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
@@ -700,16 +701,17 @@ BEGIN
CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,63,10
DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14
PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14
- PUSHBUTTON "&Replace",IDC_REPLACE,211,41,55,14
- PUSHBUTTON "In &Selection",IDC_REPLACEINSEL,211,68,55,14
- PUSHBUTTON "Replace &All",IDC_REPLACEALL,211,86,55,14
- PUSHBUTTON "Swap Strings",IDC_SWAPSTRG,150,32,49,12
- PUSHBUTTON "Close",IDCANCEL,211,127,55,14
+ PUSHBUTTON "&Replace",IDC_REPLACE,211,53,55,14
+ PUSHBUTTON "In &Selection",IDC_REPLACEINSEL,211,70,55,14
+ PUSHBUTTON "Replace &All",IDC_REPLACEALL,211,88,55,14
+ PUSHBUTTON "Swap Strings",IDC_SWAPSTRG,149,32,49,12
+ PUSHBUTTON "Close",IDCANCEL,211,126,55,14
CONTROL "Goto Find (Ctrl+F)",IDC_TOGGLEFINDREPLACE,
- "SysLink",0x0,125,131,74,10
+ "SysLink",0x0,125,130,74,10
CONTROL "(?)",IDC_BACKSLASHHELP,"SysLink",0x0,107,102,14,10
CONTROL "(?)",IDC_REGEXPHELP,"SysLink",0x0,107,114,14,10
CONTROL "(?)",IDC_WILDCARDHELP,"SysLink",0x0,191,114,14,10
+ CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,144,259,9,WS_EX_STATICEDGE
END
IDD_RUN DIALOGEX 0, 0, 229, 96
@@ -1173,7 +1175,7 @@ BEGIN
RIGHTMARGIN, 266
VERTGUIDE, 7
TOPMARGIN, 7
- BOTTOMMARGIN, 114
+ BOTTOMMARGIN, 113
END
IDD_REPLACE, DIALOG
@@ -1182,7 +1184,7 @@ BEGIN
RIGHTMARGIN, 266
VERTGUIDE, 7
TOPMARGIN, 7
- BOTTOMMARGIN, 141
+ BOTTOMMARGIN, 140
END
IDD_RUN, DIALOG
@@ -1446,6 +1448,7 @@ BEGIN
IDS_BACKSLASHHELP "Backslash Transformations\n\n\\a\tAlert (BEL, Ascii 7)\n\\b\tBackspace (BS, Ascii 8)\n\\f\tFormfeed (FF, Ascii 12)\n\\n\tNewline (LF, Ascii 10)\n\\r\tCarriage return (CR, Ascii 13)\n\\t\tHorizontal Tab (HT, Ascii 9)\n\\v\tVertical Tab (VT, Ascii 11)\n\\0oo\tOctal Value\n\\u####\tHexadecimal Value\n\\xhh\tHexadecimal Value\n\\\\\tBackslash"
IDS_REGEXPHELP "RegExp Matching Syntax (Multi Lines)\n\n.\tMatches any character\n^\tEmpty string immediately after Newline\n$\tEmpty string immediately before End of Line\n\\<\tStart of a word\n\\>\tEnd of a word\n\\b\tWord boundary\n[...]\tA set of chars ([abc]) or a range ([a-z])\n[^...]\tChars NOT in the set or range\n\\d\tAny decimal digit\n\\D\tAny non-digit char\n\\s\tAny whitespace char\n\\S\tNot a whitespace char\n\\w\tAny ""word"" char\n\\W\tAny ""non-word"" char\n\\x\tEscape character with otherwise special meaning\n\\xHH\tChar with hex code HH\n?\tMatches preceding 0 or 1 times\n*\tMatches preceding 0 or more times\n+\tMatches preceding 1 or more times\n*? or +?\tNon greedy matching of quantifiers ""?"" and ""+""\n(\tStart of a region\n)\tEnd of a region\n\\n\tRefers to a region when replacing (n is 1-9)\n"
IDS_WILDCARDHELP "Wildcard Search\n\n*\tMatches zero or more characters.\n?\tMatches exactly one character. "
+ IDS_FR_STATUS_FMT " Ln %s / %s Col %s Sel %s Occ %s Repl %s "
END
STRINGTABLE
diff --git a/src/resource.h b/src/resource.h
index 2a53528fb..51fd87add 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -161,6 +161,7 @@
#define IDS_PASS_FAILURE 511
#define IDS_NOPASS 512
#define IDM_HELP_UPDATECHECK 513
+#define IDS_FR_STATUS_TEXT 514
#define IDS_APPTITLE 10000
#define IDS_APPTITLE_ELEVATED 10001
#define IDS_APPTITLE_PASTEBOARD 10002
@@ -183,6 +184,7 @@
#define IDS_BACKSLASHHELP 10019
#define IDS_REGEXPHELP 10020
#define IDS_WILDCARDHELP 10021
+#define IDS_FR_STATUS_FMT 10022
#define CMD_ESCAPE 20000
#define CMD_SHIFTESC 20001
#define CMD_SHIFTCTRLENTER 20002