+fix: file URL tooltip

This commit is contained in:
Rainer Kottenhoff 2021-08-05 10:41:15 +02:00
parent dabf8dc4c5
commit ea5fa29795
3 changed files with 10 additions and 10 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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://")];