mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #3546 from RaiKoHoff/Dev_DM_STD
Fix file URL tooltip
This commit is contained in:
commit
6ceffde276
@ -1541,27 +1541,26 @@ DWORD NormalizePathEx(LPWSTR lpszPath, DWORD cchBuffer, bool bRealPath, bool bSe
|
||||
//
|
||||
// SplitFilePathLineNum()
|
||||
//
|
||||
void SplitFilePathLineNum(LPWSTR lpszPath, int * lineNum) {
|
||||
bool SplitFilePathLineNum(LPWSTR lpszPath, int* lineNum) {
|
||||
|
||||
LPWSTR const lpszSplit = StrRChr(lpszPath, NULL, L':');
|
||||
|
||||
bool res = false;
|
||||
if (lpszSplit) {
|
||||
char chLnNumber[128];
|
||||
char const defchar = (char)0x24;
|
||||
WideCharToMultiByte(CP_ACP, (WC_COMPOSITECHECK | WC_DISCARDNS), &lpszSplit[1], -1, chLnNumber, COUNTOF(chLnNumber), &defchar, NULL);
|
||||
te_xint_t iExprError = 0;
|
||||
te_xint_t iExprError = true;
|
||||
int const ln = (int)te_interp(chLnNumber, &iExprError);
|
||||
if (iExprError == 0) {
|
||||
if (!iExprError) {
|
||||
res = true;
|
||||
lpszSplit[0] = L'\0'; // split
|
||||
if (lineNum) {
|
||||
*lineNum = ln;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (lineNum) {
|
||||
*lineNum = -1; // not found
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ bool PathCanonicalizeEx(LPWSTR lpszPath, DWORD cchPath);
|
||||
DWORD GetLongPathNameEx(LPWSTR lpszPath, DWORD cchBuffer);
|
||||
void PathGetDisplayName(LPWSTR lpszDestPath, DWORD cchDestBuffer, LPCWSTR lpszSourcePath);
|
||||
DWORD NormalizePathEx(LPWSTR lpszPath, DWORD cchBuffer, bool bRealPath, bool bSearchPathIfRelative);
|
||||
void SplitFilePathLineNum(LPWSTR lpszPath, int *lineNum);
|
||||
bool SplitFilePathLineNum(LPWSTR lpszPath, int *lineNum);
|
||||
|
||||
bool StrLTrimI(LPWSTR pszSource,LPCWSTR pszTrimChars);
|
||||
bool StrRTrimI(LPWSTR pszSource,LPCWSTR pszTrimChars);
|
||||
|
||||
@ -6919,14 +6919,15 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
if (StrStrIA(chScheme, "file:") == chScheme) {
|
||||
|
||||
WCHAR wchUrl[INTERNET_MAX_URL_LENGTH] = { L'\0' };
|
||||
WCHAR wchPath[MAX_PATH] = { L'\0' };
|
||||
|
||||
int const cchUrl = MultiByteToWideChar(Encoding_SciCP, 0, pUrlBegin, (int)length, wchUrl, COUNTOF(wchUrl));
|
||||
wchUrl[cchUrl] = L'\0';
|
||||
StrTrim(wchUrl, L" \r\n\t");
|
||||
|
||||
SplitFilePathLineNum(wchPath, NULL);
|
||||
int ln = -1;
|
||||
SplitFilePathLineNum(wchUrl, &ln);
|
||||
|
||||
WCHAR wchPath[MAX_PATH] = { L'\0' };
|
||||
DWORD cchPath = MAX_PATH;
|
||||
if (FAILED(PathCreateFromUrl(wchUrl, wchPath, &cchPath, 0))) {
|
||||
const char *p = &pUrlBegin[CONSTSTRGLEN("file://")];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user