mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
Merge pull request #2695 from RaiKoHoff/Dev_NewFeatures
Remove max count limitation for "Mark Occurrences" feature
This commit is contained in:
commit
4601ee031b
@ -19,7 +19,6 @@ SettingsVersion=4
|
||||
;FileCheckInverval=2000
|
||||
;FileDlgFilters=
|
||||
;FileLoadWarningMB=64
|
||||
;MarkOccurrencesMaxCount=2000
|
||||
;MultiFileArg=0
|
||||
;NoCGIGuess=0
|
||||
;NoCopyLineOnEmptySelection=0
|
||||
|
||||
@ -1177,10 +1177,6 @@ void LoadSettings()
|
||||
Defaults2.SciFontQuality = SC_EFF_QUALITY_LCD_OPTIMIZED;
|
||||
Settings2.SciFontQuality = clampi(IniSectionGetInt(IniSecSettings2, L"SciFontQuality", Defaults2.SciFontQuality), SC_EFF_QUALITY_DEFAULT, SC_EFF_QUALITY_LCD_OPTIMIZED);
|
||||
|
||||
Defaults2.MarkOccurrencesMaxCount = 2000;
|
||||
Settings2.MarkOccurrencesMaxCount = IniSectionGetInt(IniSecSettings2, L"MarkOccurrencesMaxCount", Defaults2.MarkOccurrencesMaxCount);
|
||||
if (Settings2.MarkOccurrencesMaxCount <= 0) { Settings2.MarkOccurrencesMaxCount = INT_MAX; }
|
||||
|
||||
Defaults2.UpdateDelayMarkAllOccurrences = 50;
|
||||
Settings2.UpdateDelayMarkAllOccurrences = clampi(IniSectionGetInt(IniSecSettings2, L"UpdateDelayMarkAllOccurrences",
|
||||
Defaults2.UpdateDelayMarkAllOccurrences), USER_TIMER_MINIMUM, 10000);
|
||||
@ -1946,9 +1942,11 @@ static bool _SaveSettings(bool bForceSaveSettings)
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, CustomSchemesDlgPosY);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
//const WCHAR* const IniSecSettings2 = Constants.Settings2_Section;
|
||||
const WCHAR* const IniSecSettings2 = Constants.Settings2_Section;
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// --- remove deprecated ---
|
||||
IniSectionDelete(IniSecSettings2, L"MarkOccurrencesMaxCount", false);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
const WCHAR* const IniSecWindow = Constants.Window_Section;
|
||||
|
||||
17
src/Edit.c
17
src/Edit.c
@ -5727,7 +5727,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED);
|
||||
} else {
|
||||
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
|
||||
Globals.iMarkOccurrencesCount = (DocPos)-1;
|
||||
Globals.iMarkOccurrencesCount = 0;
|
||||
}
|
||||
|
||||
if (sg_pefrData->fuFlags & SCFIND_MATCHCASE) {
|
||||
@ -5846,7 +5846,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
}
|
||||
else {
|
||||
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
|
||||
Globals.iMarkOccurrencesCount = (DocPos)-1;
|
||||
Globals.iMarkOccurrencesCount = 0;
|
||||
}
|
||||
|
||||
if (s_InitialTopLine >= 0) {
|
||||
@ -6121,7 +6121,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
EditToggleView(sg_pefrData->hwnd);
|
||||
}
|
||||
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
|
||||
Globals.iMarkOccurrencesCount = (DocPos)-1;
|
||||
Globals.iMarkOccurrencesCount = 0;
|
||||
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, TRUE);
|
||||
}
|
||||
}
|
||||
@ -7284,8 +7284,7 @@ void EditMarkAll(char* pszFind, int sFlags, DocPos rangeStart, DocPos rangeEnd,
|
||||
|
||||
DocPos iPos = (DocPos)-1;
|
||||
|
||||
DocPos const limit = bMultiSel ? iTextEnd + 1 : (DocPos)Settings2.MarkOccurrencesMaxCount;
|
||||
DocPos count = 0;
|
||||
DocPosU count = 0;
|
||||
do {
|
||||
|
||||
iPos = _FindInTarget(pszText, iFindLength, sFlags, &start, &end, (start == iPos), FRMOD_IGNORE);
|
||||
@ -7295,10 +7294,12 @@ void EditMarkAll(char* pszFind, int sFlags, DocPos rangeStart, DocPos rangeEnd,
|
||||
}
|
||||
|
||||
if (bMultiSel) {
|
||||
if (count)
|
||||
if (count) {
|
||||
SciCall_AddSelection(end, iPos);
|
||||
else
|
||||
}
|
||||
else {
|
||||
SciCall_SetSelection(end, iPos);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// mark this match if not done before
|
||||
@ -7311,7 +7312,7 @@ void EditMarkAll(char* pszFind, int sFlags, DocPos rangeStart, DocPos rangeEnd,
|
||||
end = rangeEnd;
|
||||
++count;
|
||||
|
||||
} while ((count < limit) && (start < end));
|
||||
} while (start < end);
|
||||
|
||||
Globals.iMarkOccurrencesCount = count;
|
||||
}
|
||||
|
||||
@ -1541,7 +1541,7 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
|
||||
SetNotifyIconTitle(Globals.hwndMain);
|
||||
}
|
||||
Globals.iReplacedOccurrences = 0;
|
||||
Globals.iMarkOccurrencesCount = IsMarkOccurrencesEnabled() ? 0 : (DocPos)-1;
|
||||
Globals.iMarkOccurrencesCount = 0;
|
||||
|
||||
UpdateToolbar();
|
||||
UpdateStatusbar(true);
|
||||
@ -5298,7 +5298,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
else {
|
||||
EditClearAllOccurrenceMarkers(Globals.hwndEdit);
|
||||
Globals.iMarkOccurrencesCount = IsMarkOccurrencesEnabled() ? 0 : (DocPos)-1;
|
||||
Globals.iMarkOccurrencesCount = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -8887,23 +8887,14 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
// number of occurrence marks found
|
||||
if (s_iStatusbarVisible[STATUS_OCCURRENCE] || bIsWindowFindReplace)
|
||||
{
|
||||
static DocPos s_iMarkOccurrencesCount = (DocPos)-111;
|
||||
static DocPosU s_iMarkOccurrencesCount = 0;
|
||||
static bool s_bMOVisible = false;
|
||||
if (bForceRedraw || ((s_bMOVisible != Settings.MarkOccurrencesMatchVisible) || (s_iMarkOccurrencesCount != Globals.iMarkOccurrencesCount)))
|
||||
{
|
||||
if (Globals.iMarkOccurrencesCount >= 0)
|
||||
if (Globals.iMarkOccurrencesCount > 0)
|
||||
{
|
||||
if ((Settings2.MarkOccurrencesMaxCount < 0) || (Globals.iMarkOccurrencesCount < (DocPos)Settings2.MarkOccurrencesMaxCount))
|
||||
{
|
||||
StringCchPrintf(tchOcc, COUNTOF(tchOcc), DOCPOSFMTW, Globals.iMarkOccurrencesCount);
|
||||
FormatNumberStr(tchOcc, COUNTOF(tchOcc), 0);
|
||||
}
|
||||
else {
|
||||
static WCHAR tchTmp[32] = { L'\0' };
|
||||
StringCchPrintf(tchTmp, COUNTOF(tchTmp), DOCPOSFMTW, Globals.iMarkOccurrencesCount);
|
||||
FormatNumberStr(tchTmp, COUNTOF(tchTmp), 0);
|
||||
StringCchPrintf(tchOcc, COUNTOF(tchOcc), L">= %s", tchTmp);
|
||||
}
|
||||
StringCchPrintf(tchOcc, COUNTOF(tchOcc), DOCPOSFMTW, Globals.iMarkOccurrencesCount);
|
||||
FormatNumberStr(tchOcc, COUNTOF(tchOcc), 0);
|
||||
}
|
||||
else {
|
||||
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--");
|
||||
|
||||
@ -379,7 +379,7 @@ typedef struct _globals_t
|
||||
bool bZeroBasedColumnIndex;
|
||||
bool bZeroBasedCharacterCount;
|
||||
int iReplacedOccurrences;
|
||||
DocPos iMarkOccurrencesCount;
|
||||
DocPosU iMarkOccurrencesCount;
|
||||
bool bUseLimitedAutoCCharSet;
|
||||
bool bIsCJKInputCodePage;
|
||||
bool bIniFileFromScratch;
|
||||
@ -562,7 +562,6 @@ typedef struct _settings2_t
|
||||
int IMEInteraction;
|
||||
int SciFontQuality;
|
||||
|
||||
int MarkOccurrencesMaxCount;
|
||||
int UpdateDelayMarkAllOccurrences;
|
||||
bool DenyVirtualSpaceAccess;
|
||||
bool UseOldStyleBraceMatching;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user