mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+fix: grepWinNP3 not intended switching file size search settings
This commit is contained in:
parent
7f06788b93
commit
f74c4154ed
@ -113,7 +113,7 @@ CSearchDlg::CSearchDlg(HWND hParent)
|
||||
, m_bUseRegex(false)
|
||||
, m_bUseRegexForPaths(false)
|
||||
, m_bAllSize(false)
|
||||
, m_lSize(0)
|
||||
, m_lSize(2000 << 10)
|
||||
, m_sizeCmp(0)
|
||||
, m_bIncludeSystem(false)
|
||||
, m_bIncludeSystemC(false)
|
||||
@ -136,7 +136,7 @@ CSearchDlg::CSearchDlg(HWND hParent)
|
||||
, m_bCaseSensitiveC(false)
|
||||
, m_bDotMatchesNewline(false)
|
||||
, m_bDotMatchesNewlineC(false)
|
||||
//, m_bNotSearch(false)
|
||||
, m_bNotSearch(false)
|
||||
, m_bCaptureSearch(false)
|
||||
, m_bSizeC(false)
|
||||
, m_endDialog(false)
|
||||
@ -361,16 +361,14 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
}
|
||||
|
||||
wchar_t buf[MAX_PATH] = {0};
|
||||
if (m_bSizeC && (m_lSize != static_cast<uint64_t>(0)))
|
||||
if (m_bSizeC && (m_lSize != MaxFileSize()))
|
||||
{
|
||||
swprintf_s(buf, _countof(buf), L"%I64u", m_lSize);
|
||||
swprintf_s(buf, _countof(buf), L"%I64u", m_lSize >> 10);
|
||||
SetDlgItemText(hwndDlg, IDC_SIZEEDIT, buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t s = _wtoll(std::wstring(m_regSize).c_str());
|
||||
if (bPortable)
|
||||
s = g_iniFile.GetLongValue(L"global", L"size", 2000);
|
||||
uint64_t const s = bPortable ? g_iniFile.GetLongValue(L"global", L"Size", 2000) : _wtoll(std::wstring(m_regSize).c_str());
|
||||
swprintf_s(buf, _countof(buf), L"%I64u", s);
|
||||
SetDlgItemText(hwndDlg, IDC_SIZEEDIT, buf);
|
||||
}
|
||||
@ -2292,7 +2290,7 @@ void CSearchDlg::DoListNotify(LPNMITEMACTIVATE lpNMItemActivate)
|
||||
|
||||
std::wstring matchString = inf.filePath + L"\n";
|
||||
std::wstring sFormat = TranslatedString(hResource, IDS_CONTEXTLINE);
|
||||
for (size_t i = 0; i < min(inf.matchLines.size(), 5); ++i)
|
||||
for (size_t i = 0; i < std::min<size_t>(inf.matchLines.size(), 5); ++i)
|
||||
{
|
||||
std::wstring matchText = inf.matchLines[i];
|
||||
CStringUtils::trim(matchText);
|
||||
@ -2830,7 +2828,6 @@ bool CSearchDlg::SaveSettings()
|
||||
|
||||
m_bAllSize = (IsDlgButtonChecked(*this, IDC_ALLSIZERADIO) == BST_CHECKED);
|
||||
|
||||
m_lSize = 0;
|
||||
m_sizeCmp = 0;
|
||||
if (!m_bAllSize)
|
||||
{
|
||||
@ -2896,9 +2893,9 @@ bool CSearchDlg::SaveSettings()
|
||||
m_regAllSize = static_cast<DWORD>(m_bAllSize);
|
||||
|
||||
if (bPortable)
|
||||
g_iniFile.SetValue(L"global", L"Size", CStringUtils::Format(L"%I64u", m_lSize / 1024).c_str());
|
||||
g_iniFile.SetValue(L"global", L"Size", CStringUtils::Format(L"%I64u", m_lSize >> 10).c_str());
|
||||
else
|
||||
m_regSize = CStringUtils::Format(L"%I64u", m_lSize / 1024).c_str();
|
||||
m_regSize = CStringUtils::Format(L"%I64u", m_lSize >> 10).c_str();
|
||||
|
||||
if (bPortable)
|
||||
g_iniFile.SetValue(L"global", L"SizeCombo", CStringUtils::Format(L"%d", m_sizeCmp).c_str());
|
||||
@ -3077,7 +3074,7 @@ DWORD CSearchDlg::SearchThread()
|
||||
auto pathBuf = std::make_unique<wchar_t[]>(MAX_PATH_NEW);
|
||||
|
||||
DWORD const nMaxNumOfWorker = std::thread::hardware_concurrency() << 2;
|
||||
DWORD const nOfWorker = max(min(bPortable ? g_iniFile.GetLongValue(L"global", L"MaxNumOfWorker", nMaxNumOfWorker >> 1) :
|
||||
DWORD const nOfWorker = std::max<long>(std::min<long>(bPortable ? g_iniFile.GetLongValue(L"global", L"MaxNumOfWorker", nMaxNumOfWorker >> 1) :
|
||||
static_cast<DWORD>(CRegStdDWORD(L"Software\\grepWinNP3\\MaxNumOfWorker", nMaxNumOfWorker >> 1)), nMaxNumOfWorker), 1);
|
||||
|
||||
s_SearchThreadMap.clear();
|
||||
@ -4204,7 +4201,7 @@ void CSearchDlg::AutoSizeAllColumns()
|
||||
Header_GetItem(headerCtrl, col, &hdi);
|
||||
int cx = ListView_GetStringWidth(hListControl, hdi.pszText) + 20; // 20 pixels for col separator and margin
|
||||
|
||||
int inc = max(1, nItemCount / 1000);
|
||||
int inc = std::max<int>(1, nItemCount / 1000);
|
||||
for (int index = 0; index < nItemCount; index = index + inc)
|
||||
{
|
||||
// get the width of the string and add 14 pixels for the column separator and margins
|
||||
|
||||
@ -30,10 +30,18 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <mutex>
|
||||
#include <limits>
|
||||
#ifdef NP3_ALLOW_UPDATE
|
||||
#include <thread>
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
# undef max
|
||||
#endif
|
||||
#ifdef min
|
||||
# undef min
|
||||
#endif
|
||||
|
||||
#include <wrl.h>
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
@ -49,6 +57,12 @@ using namespace Microsoft::WRL;
|
||||
|
||||
#define ALPHA_OPAQUE (255)
|
||||
|
||||
|
||||
static constexpr uint64_t MaxFileSize()
|
||||
{
|
||||
return std::numeric_limits<uint64_t>::max();
|
||||
}
|
||||
|
||||
enum class ExecuteAction
|
||||
{
|
||||
None,
|
||||
@ -111,7 +125,7 @@ public:
|
||||
inline void SetWholeWords(bool bSet) { m_bWholeWordsC = true; m_bWholeWords = bSet; }
|
||||
inline void SetUTF8(bool bSet) { m_bUTF8C = true; m_bUTF8 = bSet; m_bForceBinary = false; }
|
||||
inline void SetBinary(bool bSet) { m_bUTF8C = true; m_bForceBinary = bSet; m_bUTF8 = false; }
|
||||
inline void SetSize(uint64_t size, int cmp) { m_bSizeC = true; m_lSize = size; m_sizeCmp = cmp; m_bAllSize = (size == (uint64_t)0); }
|
||||
inline void SetSize(uint64_t size, int cmp) { m_bSizeC = true; m_lSize = size; m_sizeCmp = cmp; m_bAllSize = (size == MaxFileSize()); }
|
||||
inline void SetIncludeSystem(bool bSet) { m_bIncludeSystemC = true; m_bIncludeSystem = bSet; }
|
||||
inline void SetIncludeHidden(bool bSet) { m_bIncludeHiddenC = true; m_bIncludeHidden = bSet; }
|
||||
inline void SetIncludeSubfolders(bool bSet) { m_bIncludeSubfoldersC = true; m_bIncludeSubfolders = bSet; }
|
||||
|
||||
@ -4630,7 +4630,7 @@ grepWin_t;
|
||||
static grepWin_t grepWinIniSettings[13] = {
|
||||
{ L"onlyone", L"1" },
|
||||
{ L"AllSize", L"1" },
|
||||
{ L"Size", L"2000" },
|
||||
{ L"Size", L"2000" },
|
||||
{ L"CaseSensitive", L"0" },
|
||||
{ L"CreateBackup", L"1" },
|
||||
{ L"DateLimit", L"0" },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user