diff --git a/src/Edit.c b/src/Edit.c index 5ec386897..49941d84c 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -5568,16 +5568,19 @@ void EditMarkAll(HWND hwnd, char* pszFind, int flags, int rangeStart, int rangeE SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0); + int iPos = -1; do { - ++iMarkOccurrencesCount; - int iPos = EditFindInTarget(hwnd, pszText, iFindLength, flags, &start, &end, (end == start)); + iPos = EditFindInTarget(hwnd, pszText, iFindLength, flags, &start, &end, (start == iPos)); + + ++iMarkOccurrencesCount; // -1 -> 0 if (iPos < 0) break; // not found // mark this match if not done before - if (!SciCall_IndicatorValueAt(INDIC_NP3_MARK_OCCURANCE, iPos)) { + if (!(SciCall_IndicatorValueAt(INDIC_NP3_MARK_OCCURANCE, end) && + SciCall_IndicatorValueAt(INDIC_NP3_MARK_OCCURANCE, start))) { SciCall_IndicatorFillRange(iPos, (end - start)); } diff --git a/src/Notepad3.c b/src/Notepad3.c index 871b5abff..9610b7ee0 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -5619,10 +5619,6 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) if (scn->updated & (SC_UPDATE_SELECTION | SC_UPDATE_CONTENT)) { - // !!! SC_UPDATE_CONTENT is triggered very often , - // even if nothing relevant has been modified - // relevant modifications are handled in SCN_MODIFIED !!! - //~InvalidateSelections(); // fixed in SCI ? // Brace Match @@ -5631,6 +5627,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) } if (iMarkOccurrences) { + // clear marks only, if caret/selection changed if (scn->updated & SC_UPDATE_SELECTION) { EditClearAllMarks(g_hwndEdit, 0, -1); }