+ fix: Show replacement count info-box after UI update (extended selection, replaced pattern)

This commit is contained in:
Rainer Kottenhoff 2018-03-14 17:29:00 +01:00
parent ad672827bc
commit 65aced173c
2 changed files with 21 additions and 13 deletions

View File

@ -5756,7 +5756,7 @@ static UT_icd ReplPos_icd = { sizeof(ReplPos_t), NULL, NULL, NULL };
// -------------------------------------------------------------------------------------------------------
int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, DocPos iStartPos, DocPos iEndPos, DocPos* enlargement)
int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, DocPos iStartPos, DocPos iEndPos, DocPos* enlargement)
{
char szFind[FNDRPL_BUFFER];
@ -5782,7 +5782,6 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, D
if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) {
InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID);
bShowInfo = FALSE;
}
// === build array of matches for later replacements ===
@ -5829,17 +5828,12 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, D
EditLeaveTargetTransaction();
}
ObserveNotifyChangeEvent();
utarray_clear(ReplPosUTArray);
utarray_free(ReplPosUTArray);
LocalFree(pszReplace);
if (bShowInfo) {
if (iCount > 0)
InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iCount);
else
InfoBox(0, L"MsgNotFound", IDS_NOTFOUND);
}
*enlargement = offset;
return iCount;
@ -5860,12 +5854,19 @@ BOOL EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo)
int token = BeginUndoAction();
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, bShowInfo, start, end, &enlargement);
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
EndUndoAction(token);
EndWaitCursor();
if (bShowInfo) {
if (iReplacedOccurrences > 0)
InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iReplacedOccurrences);
else
InfoBox(0, L"MsgNotFound", IDS_NOTFOUND);
}
return (iReplacedOccurrences > 0) ? TRUE : FALSE;
}
@ -5895,7 +5896,7 @@ BOOL EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowIn
int token = BeginUndoAction();
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, bShowInfo, start, end, &enlargement);
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
if (bWaitCursor) {
EndWaitCursor();
@ -5913,7 +5914,14 @@ BOOL EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowIn
EndUndoAction(token);
return TRUE;
if (bShowInfo) {
if (iReplacedOccurrences > 0)
InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iReplacedOccurrences);
else
InfoBox(0, L"MsgNotFound", IDS_NOTFOUND);
}
return (iReplacedOccurrences > 0) ? TRUE : FALSE;
}

View File

@ -117,7 +117,7 @@ HWND EditFindReplaceDlg(HWND,LPCEDITFINDREPLACE,BOOL);
BOOL EditFindNext(HWND,LPCEDITFINDREPLACE,BOOL,BOOL);
BOOL EditFindPrev(HWND,LPCEDITFINDREPLACE,BOOL,BOOL);
BOOL EditReplace(HWND,LPCEDITFINDREPLACE);
int EditReplaceAllInRange(HWND,LPCEDITFINDREPLACE,BOOL, DocPos, DocPos, DocPos*);
int EditReplaceAllInRange(HWND,LPCEDITFINDREPLACE,DocPos,DocPos,DocPos*);
BOOL EditReplaceAll(HWND,LPCEDITFINDREPLACE,BOOL);
BOOL EditReplaceAllInSelection(HWND,LPCEDITFINDREPLACE,BOOL);
BOOL EditLinenumDlg(HWND);