From c3ffe35492ce01419919389f69c7dfb26a3977e4 Mon Sep 17 00:00:00 2001 From: ArkadiuszMichalski Date: Fri, 28 Oct 2022 11:21:11 +0200 Subject: [PATCH] Enhance "Allow clickable link" option for Large File Restriction Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/12369#issuecomment-1287821244. --- PowerEditor/src/Notepad_plus.cpp | 5 +---- PowerEditor/src/WinControls/Preference/preferenceDlg.cpp | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index bc2322411..ba9eab507 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3018,10 +3018,7 @@ bool isUrl(TCHAR * text, int textLen, int start, int* segmentLen) void Notepad_plus::addHotSpot(ScintillaEditView* view) { ScintillaEditView* pView = view ? view : _pEditView; - Buffer* currentBuf = pView->getCurrentBuffer(); - if (!currentBuf->allowClickableLink()) - return; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL; LPARAM indicStyle = (urlAction == urlNoUnderLineFg) || (urlAction == urlNoUnderLineBg) ? INDIC_HIDDEN : INDIC_PLAIN; @@ -3042,7 +3039,7 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view) pView->getVisibleStartAndEndPosition(&startPos, &endPos); if (startPos >= endPos) return; pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC); - if (urlAction == urlDisable) + if (urlAction == urlDisable || !currentBuf->allowClickableLink()) { pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos); return; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index c44d3885a..c5b972436 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -5019,7 +5019,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L } else { - SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); } } return TRUE; @@ -5053,8 +5053,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L { bool isAllowed = isCheckedOrNot(int(wParam)); nppGUI._largeFileRestriction._allowClickableLink = isAllowed; - if (isAllowed) - SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); } return TRUE;