mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ fix: Mark Occurrences: force position progress in case of zero-length matches
This commit is contained in:
parent
a5be1a362f
commit
b352dd05eb
@ -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));
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user