Enhance "Allow clickable link" option for Large File Restriction

Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/12369#issuecomment-1287821244.
This commit is contained in:
ArkadiuszMichalski 2022-10-28 11:21:11 +02:00 committed by Don Ho
parent b4f569b8ba
commit c3ffe35492
2 changed files with 3 additions and 7 deletions

View File

@ -3018,10 +3018,7 @@ bool isUrl(TCHAR * text, int textLen, int start, int* segmentLen)
void Notepad_plus::addHotSpot(ScintillaEditView* view) void Notepad_plus::addHotSpot(ScintillaEditView* view)
{ {
ScintillaEditView* pView = view ? view : _pEditView; ScintillaEditView* pView = view ? view : _pEditView;
Buffer* currentBuf = pView->getCurrentBuffer(); Buffer* currentBuf = pView->getCurrentBuffer();
if (!currentBuf->allowClickableLink())
return;
int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
LPARAM indicStyle = (urlAction == urlNoUnderLineFg) || (urlAction == urlNoUnderLineBg) ? INDIC_HIDDEN : INDIC_PLAIN; LPARAM indicStyle = (urlAction == urlNoUnderLineFg) || (urlAction == urlNoUnderLineBg) ? INDIC_HIDDEN : INDIC_PLAIN;
@ -3042,7 +3039,7 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view)
pView->getVisibleStartAndEndPosition(&startPos, &endPos); pView->getVisibleStartAndEndPosition(&startPos, &endPos);
if (startPos >= endPos) return; if (startPos >= endPos) return;
pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC); pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC);
if (urlAction == urlDisable) if (urlAction == urlDisable || !currentBuf->allowClickableLink())
{ {
pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos); pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos);
return; return;

View File

@ -5019,7 +5019,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
} }
else else
{ {
SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0);
} }
} }
return TRUE; return TRUE;
@ -5053,8 +5053,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
{ {
bool isAllowed = isCheckedOrNot(int(wParam)); bool isAllowed = isCheckedOrNot(int(wParam));
nppGUI._largeFileRestriction._allowClickableLink = isAllowed; nppGUI._largeFileRestriction._allowClickableLink = isAllowed;
if (isAllowed) ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0);
SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0);
} }
return TRUE; return TRUE;