Merge pull request #1245 from RaiKoHoff/Dev_RC

Restore occurrence marker on Find/Replace closing
This commit is contained in:
Rainer Kottenhoff 2019-05-26 02:47:38 +02:00 committed by GitHub
commit c81f437a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 27 deletions

View File

@ -1 +1 @@
1723
1725

View File

@ -3,7 +3,7 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.19.525.1723"
version="5.19.526.1725"
type="win32"
/>
<description>Notepad3 RC</description>

View File

@ -5042,9 +5042,6 @@ static int s_SaveMarkOccurrences = 0;
static bool s_SaveMarkMatchVisible = false;
static bool s_SaveTFBackSlashes = false;
static inline void SwitchMarkOccurrences_ON() { Settings.MarkOccurrences = max_i(1, s_SaveMarkOccurrences); }
static inline void SwitchMarkOccurrences_OFF() { Settings.MarkOccurrences = 0; }
static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
{
static LPEDITFINDREPLACE sg_pefrData = NULL;
@ -5153,6 +5150,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
else {
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_UNCHECKED);
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
Globals.iMarkOccurrencesCount = -1;
}
if (sg_pefrData->fuFlags & SCFIND_REGEXP) {
@ -5252,19 +5250,22 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
}
sg_pefrData->szFind[0] = '\0';
Settings.MarkOccurrences = s_SaveMarkOccurrences;
Settings.MarkOccurrencesMatchVisible = s_SaveMarkMatchVisible;
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, Settings.MarkOccurrences);
Globals.iReplacedOccurrences = 0;
Globals.FindReplaceMatchFoundState = FND_NOP;
if (FocusedView.HideNonMatchedLines) {
SwitchMarkOccurrences_ON();
EditToggleView(sg_pefrData->hwnd);
SwitchMarkOccurrences_OFF();
Settings.MarkOccurrences = s_SaveMarkOccurrences;
Settings.MarkOccurrencesMatchVisible = s_SaveMarkMatchVisible;
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, true);
if (IsMarkOccurrencesEnabled()) {
MarkAllOccurrences(50, true);
}
else {
if (FocusedView.HideNonMatchedLines) {
EditToggleView(sg_pefrData->hwnd);
}
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
Globals.iMarkOccurrencesCount = -1;
}
MarkAllOccurrences(50, true);
if (s_InitialTopLine >= 0) {
SciCall_SetFirstVisibleLine(s_InitialTopLine);
@ -5487,9 +5488,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
_IGNORE_NOTIFY_CHANGE_;
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
StringCchCopyA(s_lastFind, COUNTOF(s_lastFind), sg_pefrData->szFind);
SwitchMarkOccurrences_ON();
RegExResult_t match = _FindHasMatch(sg_pefrData->hwnd, sg_pefrData, 0, (sg_pefrData->bMarkOccurences), false);
SwitchMarkOccurrences_OFF();
if (s_anyMatch != match) { s_anyMatch = match; }
// we have to set Sci's regex instance to first find (have substitution in place)
DocPos const iStartPos = (DocPos)lParam;
@ -5509,11 +5508,8 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
EditSetSelectionEx(sg_pefrData->hwnd, s_InitialAnchorPos, s_InitialCaretPos, -1, -1);
}
if (FocusedView.HideNonMatchedLines) {
SwitchMarkOccurrences_ON();
EditToggleView(sg_pefrData->hwnd);
SwitchMarkOccurrences_OFF();
}
Settings.MarkOccurrences = s_SaveMarkOccurrences;
MarkAllOccurrences(4, true);
}
_OBSERVE_NOTIFY_CHANGE_;
@ -5543,7 +5539,11 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
}
else { // switched OFF
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false);
if (FocusedView.HideNonMatchedLines) {
EditToggleView(sg_pefrData->hwnd);
}
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
Globals.iMarkOccurrencesCount = -1;
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true);
}
}
@ -5551,9 +5551,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
case IDC_TOGGLE_VISIBILITY:
SwitchMarkOccurrences_ON();
EditToggleView(sg_pefrData->hwnd);
SwitchMarkOccurrences_OFF();
if (!FocusedView.HideNonMatchedLines) {
sg_pefrData->bStateChanged = true;
s_InitialTopLine = -1; // reset
@ -6438,8 +6436,7 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn
void EditClearAllOccurrenceMarkers(HWND hwnd)
{
UNUSED(hwnd);
Globals.iMarkOccurrencesCount = IsMarkOccurrencesEnabled() ? 0 : -1;
Globals.iMarkOccurrencesCount = 0;
_IGNORE_NOTIFY_CHANGE_;

View File

@ -4952,8 +4952,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
if ((Settings.MarkOccurrences <= 0) && FocusedView.HideNonMatchedLines) {
EditToggleView(Globals.hwndEdit);
}
EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0));
MarkAllOccurrences(0, true);
EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, IsMarkOccurrencesEnabled());
if (IsMarkOccurrencesEnabled()) {
MarkAllOccurrences(0, true);
}
else {
EditClearAllOccurrenceMarkers(Globals.hwndEdit);
Globals.iMarkOccurrencesCount = IsMarkOccurrencesEnabled() ? 0 : -1;
}
UpdateToolbar();
break;

View File

@ -7,8 +7,8 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 19
#define VERSION_REV 525
#define VERSION_BUILD 1723
#define VERSION_REV 526
#define VERSION_BUILD 1725
#define SCINTILLA_VER 415+
#define ONIGMO_REGEX_VER 6.2.0
#define VERSION_PATCH RC