From 1b3476cdb887076da40cd25cc66ee80fbc97a3f7 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Thu, 17 Feb 2022 18:37:28 +0100 Subject: [PATCH 1/2] +fix: regression caused by previous fix --- src/Edit.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index 76161ed4f..84259d094 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -7582,13 +7582,13 @@ int EditAddSearchFlags(int flags, bool bRegEx, bool bWordStart, bool bMatchCase, // void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd, bool bMultiSel) { - BeginWaitCursorUID(Flags.bHugeFileLoadState, IDS_MUI_SB_MARK_ALL_OCC); - DocPos iFindLength = 0; char chText[2048] = { L'\0'}; WCHAR wchText[2048] = { L'\0'}; + IgnoreNotifyDocChangedEvent(EVM_Default); + if (StrIsEmpty(wchFind)) { WideCharToMultiByte(Encoding_SciCP, 0, wchFind, -1, chText, COUNTOF(chText), NULL, NULL); @@ -7600,19 +7600,19 @@ void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd DocPos iWordStart = SciCall_WordStartPosition(iCurPos, true); DocPos iWordEnd = SciCall_WordEndPosition(iCurPos, true); if (iWordStart == iWordEnd) { - __leave; + goto observe; } iFindLength = (iWordEnd - iWordStart); StringCchCopyNA(chText, COUNTOF(chText), SciCall_GetRangePointer(iWordStart, iFindLength), iFindLength); } else { - __leave; // no pattern, no selection and no word mark chosen + goto observe; // no pattern, no selection and no word mark chosen } } else { // we have a selection if (Sci_IsMultiSelection()) { - __leave; + goto observe; } // get current selection @@ -7622,12 +7622,12 @@ void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd // if multiple lines are selected exit if (SciCall_LineFromPosition(iSelStart) != SciCall_LineFromPosition(iSelEnd)) { - __leave; + goto observe; } DocPosU const iSelLen = SciCall_GetSelText(NULL); if (iSelLen >= COUNTOF(chText)) { - __leave; + goto observe; } iFindLength = SciCall_GetSelText(chText); @@ -7639,7 +7639,7 @@ void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd const char* delims = (Settings.AccelWordNavigation ? DelimCharsAccel : DelimChars); while ((iSelStart2 <= iSelLen) && chText[iSelStart2]) { if (StrChrIA(delims, chText[iSelStart2])) { - __leave; + goto observe; } ++iSelStart2; } @@ -7692,7 +7692,10 @@ void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd } Globals.iMarkOccurrencesCount = count; } - EndWaitCursor(); + +observe: + + ObserveNotifyDocChangedEvent(); } From b1bf93280e1c4559959a256332a49df2eda48fc1 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Thu, 17 Feb 2022 19:21:36 +0100 Subject: [PATCH 2/2] +fix: Find Next/Prev behavior --- src/Edit.c | 6 +----- src/Notepad3.c | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index 84259d094..0dd609785 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -7587,7 +7587,7 @@ void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd char chText[2048] = { L'\0'}; WCHAR wchText[2048] = { L'\0'}; - IgnoreNotifyDocChangedEvent(EVM_Default); + IgnoreNotifyDocChangedEvent(EVM_Default); // goto observe: if (StrIsEmpty(wchFind)) { @@ -7686,10 +7686,6 @@ void EditMarkAll(LPCWSTR wchFind, int sFlags, DocPos rangeStart, DocPos rangeEnd end = rangeEnd; iPos = _FindInTarget(wchText, sFlags, &start, &end, true, FRMOD_NORM); }; - - if (count > 0) { - SciCall_SetSelectionNCaret(SciCall_GetMainSelection(), SciCall_GetSelectionNEnd(SciCall_GetMainSelection())); - } Globals.iMarkOccurrencesCount = count; } diff --git a/src/Notepad3.c b/src/Notepad3.c index 0c96ce3a9..2c172ac15 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -5566,11 +5566,11 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) switch (iLoWParam) { case IDM_EDIT_FINDNEXT: - EditFindNext(Globals.hwndEdit, &s_FindReplaceData, false, false, false); + EditFindNext(Globals.hwndEdit, &s_FindReplaceData, false, false, true); break; case IDM_EDIT_FINDPREV: - EditFindPrev(Globals.hwndEdit, &s_FindReplaceData, false, false, false); + EditFindPrev(Globals.hwndEdit, &s_FindReplaceData, false, false, true); break; case IDM_EDIT_REPLACENEXT: