Skip to content

Commit

Permalink
21.5.20 Some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tablacus committed May 20, 2021
1 parent e3f96ac commit bbce28d
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 41 deletions.
19 changes: 11 additions & 8 deletions Debug/script/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ g_.DefaultIcons = {

AboutTE = function (n) {
if (n == 0) {
return te.Version < 20210519 ? te.Version : 20210519;
return te.Version < 20210520 ? te.Version : 20210520;
}
if (n == 1) {
const v = AboutTE(0);
Expand Down Expand Up @@ -1434,7 +1434,7 @@ MakeImgIcon = function (src, index, h, bIcon, clBk) {
const hOld = api.SelectObject(hmdc, hbm);
const rc = api.Memory("RECT");
if ("number" !== typeof clBk) {
clBk = -COLOR_WINDOW;
clBk = CLR_DEFAULT | COLOR_WINDOW;
}
if (clBk < 0) {
clBk = GetSysColor(clBk & 31);
Expand Down Expand Up @@ -2003,12 +2003,15 @@ ExtractPath = function (Ctrl, s, pt) {
}

PathMatchEx = function (path, s) {
const hr = MainWindow.RunEvent3("PathMatch", path, s);
if (isFinite(hr)) {
return hr;
}
const res = /^\/(.*)\/(.*)/.exec(s);
return res ? new RegExp(res[1], res[2]).test(path) : api.PathMatchSpec(path, s);
try {
const hr = MainWindow.RunEvent3("PathMatch", path, s);
if (isFinite(hr)) {
return hr;
}
const res = /^\/(.*)\/(.*)/.exec(s);
return res ? new RegExp(res[1], res[2]).test(path) : api.PathMatchSpec(path, s);
} catch (e) { }
return true;
}

IsFolderEx = function (Item) {
Expand Down
1 change: 1 addition & 0 deletions Debug/script/sync1.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ ListViewCreated = function (Ctrl) {
ChangeTabName(Ctrl);
Ctrl.Data.AccessTime = "#";
RunEvent1("ListViewCreated", Ctrl);
te.OnFilterChanged(Ctrl);
}

TabViewCreated = function (Ctrl) {
Expand Down
2 changes: 1 addition & 1 deletion TE/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define STRING2(str) #str
#define VER_Y 21
#define VER_M 5
#define VER_D 19
#define VER_D 20

//Icon
#define IDI_TE 1
Expand Down
89 changes: 58 additions & 31 deletions TE/TE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1939,35 +1939,58 @@ BSTR teGetSearchText1(LPCITEMIDLIST pidl, BOOL bColumnFilter)
teSysFreeString(&bsSearch);
if (bsSearch2) {
int nPos = ::SysStringLen(bsSearch2) - ::SysStringLen(bsSearch1);
if (nPos <= 0) {
nPos = 0;
} else if (!StrChr(bsSearch2, '~') && !teStartsText(g_bsAnyText, bsSearch2) && !teStartsText(g_bsAnyTextId, bsSearch2)) {
nPos = 0;
}
if (lstrcmpi(bsSearch1, &bsSearch2[nPos])) {
if (bColumnFilter) {
bsSearch = bsSearch2;
bsSearch2 = NULL;
if (!StrChr(bsSearch, '"')) {
for (int i = 0; i < ::SysStringLen(bsSearch); ++i) {
if (bsSearch[i] == ':' || bsSearch[i] == 0xff1a) {
if (StrCmpNI(bsSearch, bsSearch1, i)) {
int nLen = lstrlen(&bsSearch[i + 1]);
if (nLen >= 32 && bsSearch[i + 1] != '=' && lstrlen(bsSearch1) <= nLen) {
lstrcpy(&bsSearch[i + 1], bsSearch1);
if (StrCmpNI(bsSearch, g_bsName, i) == 0 && bsSearch[i + 2] == ' ' && bsSearch[i + 4] == ' ' && bsSearch[i + 6] == NULL) {// name:0 - 9
swprintf_s(&bsSearch[i + 1], ::SysStringLen(bsSearch) - i - 1, L"(>=%c <=%c%c)", bsSearch[i + 1], bsSearch[i + 5], 0xd7fb);
if (!lstrcmpi(bsSearch1, &bsSearch2[nPos >= 0 && StrChr(bsSearch2, '~') ? nPos : 0]) || StrStrI(bsSearch2, g_bsAnyText)|| StrStrI(bsSearch2, g_bsAnyTextId)) {
bsSearch = bsSearch1;
bsSearch1 = NULL;
} else if (bColumnFilter) {
bsSearch = bsSearch2;
bsSearch2 = NULL;
if (!StrChr(bsSearch, '"')) {
for (int i = 0; i < ::SysStringLen(bsSearch); ++i) {
if (bsSearch[i] == ':' || bsSearch[i] == 0xff1a) {
if (StrCmpNI(bsSearch, bsSearch1, i)) {
if (lstrlen(bsSearch1) <= lstrlen(&bsSearch[i + 1]) - 2) {
BOOL bName = !StrCmpNI(bsSearch, g_bsName, i);
if (bName || StrChr(&bsSearch[i + 1], ':')) {
LPWSTR pszHasComma = StrChr(bsSearch1, ',');
if (pszHasComma) {
lstrcpy(&bsSearch[i + 1], L"(");
} else {
bsSearch[i + 1] = NULL;
}
for (LPWSTR pszSearch = bsSearch1;;) {
while (pszSearch[0] == ' ') {
++pszSearch;
}
LPWSTR pszComma = StrChr(pszSearch, ',');
i = lstrlen(bsSearch);
if (bName && pszSearch[1] == ' ' && pszSearch[3] == ' ') {// name:0 - 9
swprintf_s(&bsSearch[i], ::SysStringLen(bsSearch) - i, L"%c..%c%c", pszSearch[0], pszSearch[4], 0xd7fb);
} else {
if (pszComma) {
StrNCpy(&bsSearch[i], pszSearch, pszComma - pszSearch + 1);
} else {
lstrcpy(&bsSearch[i], pszSearch);
}
for (LPWSTR pszSpace = &bsSearch[i]; pszSpace = StrChr(pszSpace, ' '); lstrcpy(pszSpace, &pszSpace[1]));
}
if (pszComma) {
lstrcat(bsSearch, L" OR ");
pszSearch = pszComma + 1;
} else {
break;
}
}
if (pszHasComma) {
lstrcat(bsSearch, L")");
}
}
}
break;
}
break;
}
}
}
} else {
bsSearch = bsSearch1;
bsSearch1 = NULL;
}
}
teSysFreeString(&bsSearch2);
Expand Down Expand Up @@ -3198,8 +3221,10 @@ VOID ToMinus(BSTR *pbs)
int nLen = SysStringByteLen(*pbs) + sizeof(WCHAR);
BSTR bs = SysAllocStringByteLen(NULL, nLen);
bs[0] = L'-';
::CopyMemory(&bs[1], *pbs, nLen);
::SysFreeString(*pbs);
if (*pbs) {
::CopyMemory(&bs[1], *pbs, nLen);
teSysFreeString(pbs);
}
*pbs = bs;
}

Expand Down Expand Up @@ -11539,6 +11564,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
AnyText.fmtid = PKEY_FullText.fmtid;
AnyText.pid = 12;
g_bsAnyText = tePSGetNameFromPropertyKeyEx(AnyText, 0, NULL);
for (LPWSTR pszSpace = g_bsAnyText; pszSpace = StrChr(pszSpace, ' '); lstrcpy(pszSpace, &pszSpace[1]));
g_bsAnyTextId = tePSGetNameFromPropertyKeyEx(AnyText, 1, NULL);

InitCommonControls();
Expand Down Expand Up @@ -13603,8 +13629,8 @@ VOID CteShellBrowser::InitFolderSize()
hdi.mask = HDI_TEXT | HDI_FORMAT;
Header_GetItem(hHeader, i, &hdi);
int fmt = hdi.fmt;
pColumns[i].name = ::SysAllocString(szText);
if (szText[0]) {
pColumns[i].name = ::SysAllocString(szText);
if (m_ppDispatch[SB_ColumnsReplace]) {
teGetProperty(m_ppDispatch[SB_ColumnsReplace], szText, &v);
}
Expand Down Expand Up @@ -13672,7 +13698,7 @@ VOID CteShellBrowser::InitFolderSize()
delete [] piColumns;
}
for (int i = nHeader; --i >= 0;) {
SysFreeString(pColumns[i].name);
teSysFreeString(&pColumns[i].name);
}
delete pColumns;
teSysFreeString(&bsLinkTarget);
Expand Down Expand Up @@ -14046,7 +14072,7 @@ STDMETHODIMP CteShellBrowser::OnStateChange(IShellView *ppshv, ULONG uChange)

STDMETHODIMP CteShellBrowser::IncludeObject(IShellView *ppshv, LPCITEMIDLIST pidl)
{
return IncludeObject2(m_pSF2, pidl);
return IncludeObject2(m_pSF2, pidl, NULL);
}

//ICommDlgBrowser2
Expand Down Expand Up @@ -16046,7 +16072,7 @@ HRESULT CteShellBrowser::OnNavigationPending2(LPITEMIDLIST pidlFolder)
return hr;
}

HRESULT CteShellBrowser::IncludeObject2(IShellFolder *pSF, LPCITEMIDLIST pidl)
HRESULT CteShellBrowser::IncludeObject2(IShellFolder *pSF, LPCITEMIDLIST pidl, LPITEMIDLIST pidlFull)
{
HRESULT hr = S_OK;
if (pSF) {
Expand All @@ -16070,8 +16096,9 @@ HRESULT CteShellBrowser::IncludeObject2(IShellFolder *pSF, LPCITEMIDLIST pidl)
teSetObject(&pv[3], this);
teSetSZ(&pv[2], bs);
teSetSZ(&pv[1], bs2);
LPITEMIDLIST pidlFull = ILCombine(m_pidl, pidl);
if (pidlFull) {
teSetIDList(&pv[0], pidlFull);
} else if (pidlFull = ILCombine(m_pidl, pidl)) {
teSetIDListRelease(&pv[0], &pidlFull);
}
Invoke4(m_ppDispatch[SB_OnIncludeObject], &vResult, 4, pv);
Expand Down Expand Up @@ -16435,7 +16462,7 @@ VOID CteShellBrowser::AddItem(LPITEMIDLIST pidl)
if (!ILIsEmpty(pidl)) {
if SUCCEEDED(SHBindToParent(pidl, IID_PPV_ARGS(&pSF), &pidlPart)) {
LPITEMIDLIST pidlChild = NULL;
if (IncludeObject2(pSF, pidlPart) == S_OK) {
if (IncludeObject2(pSF, pidlPart, pidl) == S_OK) {
m_bRedraw = TRUE;
SetRedraw(FALSE);
try {
Expand Down Expand Up @@ -16816,7 +16843,7 @@ STDMETHODIMP CteShellBrowser::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lPar
if SUCCEEDED(m_pSF2->EnumObjects(NULL, grfFlags, &peidl)) {
LPITEMIDLIST pidlPart = NULL;
while (iNew <= iExists && peidl->Next(1, &pidlPart, NULL) == S_OK) {
if (IncludeObject2(m_pSF2, pidlPart) == S_OK) {
if (IncludeObject2(m_pSF2, pidlPart, NULL) == S_OK) {
iNew++;
}
teCoTaskMemFree(pidlPart);
Expand Down
2 changes: 1 addition & 1 deletion TE/TE.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ class CteShellBrowser : public IShellBrowser, public ICommDlgBrowser2,
LPWSTR GetThemeName();
VOID FixColumnEmphasis();
HRESULT OnNavigationPending2(LPITEMIDLIST pidlFolder);
HRESULT IncludeObject2(IShellFolder *pSF, LPCITEMIDLIST pidl);
HRESULT IncludeObject2(IShellFolder *pSF, LPCITEMIDLIST pidl, LPITEMIDLIST pidlFull);
BOOL HasFilter();
int GetSizeFormat();
VOID SetObjectRect();
Expand Down

0 comments on commit bbce28d

Please sign in to comment.