mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
Improve performance while disabling clickable URL link
Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/15981#issuecomment-2570310216 Close #16021
This commit is contained in:
parent
c5dd85cd93
commit
71be434a33
@ -3444,6 +3444,7 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view)
|
|||||||
{
|
{
|
||||||
if (_isAttemptingCloseOnQuit)
|
if (_isAttemptingCloseOnQuit)
|
||||||
return; // don't recalculate URLs when shutting down
|
return; // don't recalculate URLs when shutting down
|
||||||
|
|
||||||
ScintillaEditView* pView = view ? view : _pEditView;
|
ScintillaEditView* pView = view ? view : _pEditView;
|
||||||
Buffer* currentBuf = pView->getCurrentBuffer();
|
Buffer* currentBuf = pView->getCurrentBuffer();
|
||||||
|
|
||||||
@ -3466,6 +3467,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 || !currentBuf->allowClickableLink())
|
if (urlAction == urlDisable || !currentBuf->allowClickableLink())
|
||||||
{
|
{
|
||||||
pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos);
|
pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos);
|
||||||
|
@ -2276,11 +2276,19 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
//reset styler for change in Stylers.xml
|
//reset styler for change in Stylers.xml
|
||||||
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
|
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
|
||||||
_mainEditView.performGlobalStyles();
|
_mainEditView.performGlobalStyles();
|
||||||
addHotSpot(& _mainEditView);
|
|
||||||
|
|
||||||
_subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType());
|
_subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType());
|
||||||
_subEditView.performGlobalStyles();
|
_subEditView.performGlobalStyles();
|
||||||
addHotSpot(& _subEditView);
|
|
||||||
|
int urlAction = nppParam.getNppGUI()._styleURL;
|
||||||
|
if (urlAction != urlDisable)
|
||||||
|
{
|
||||||
|
if (_mainEditView.getCurrentBuffer()->allowClickableLink())
|
||||||
|
addHotSpot(&_mainEditView);
|
||||||
|
|
||||||
|
if (_subEditView.getCurrentBuffer()->allowClickableLink())
|
||||||
|
addHotSpot(&_subEditView);
|
||||||
|
}
|
||||||
|
|
||||||
_findReplaceDlg.updateFinderScintilla();
|
_findReplaceDlg.updateFinderScintilla();
|
||||||
|
|
||||||
@ -3692,14 +3700,23 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
case NPPM_INTERNAL_UPDATECLICKABLELINKS:
|
case NPPM_INTERNAL_UPDATECLICKABLELINKS:
|
||||||
{
|
{
|
||||||
ScintillaEditView* pView = reinterpret_cast<ScintillaEditView*>(wParam);
|
ScintillaEditView* pView = reinterpret_cast<ScintillaEditView*>(wParam);
|
||||||
if (pView == NULL)
|
|
||||||
|
int urlAction = nppParam.getNppGUI()._styleURL;
|
||||||
|
if (urlAction != urlDisable)
|
||||||
{
|
{
|
||||||
addHotSpot(_pEditView);
|
if (pView == NULL)
|
||||||
addHotSpot(_pNonEditView);
|
{
|
||||||
}
|
if (_pEditView->getCurrentBuffer()->allowClickableLink())
|
||||||
else
|
addHotSpot(_pEditView);
|
||||||
{
|
|
||||||
addHotSpot(pView);
|
if (_pNonEditView->getCurrentBuffer()->allowClickableLink())
|
||||||
|
addHotSpot(_pNonEditView);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pView->getCurrentBuffer()->allowClickableLink())
|
||||||
|
addHotSpot(pView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -3734,8 +3751,16 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case NPPM_INTERNAL_DOCMODIFIEDBYREPLACEALL:
|
case NPPM_INTERNAL_DOCMODIFIEDBYREPLACEALL:
|
||||||
{
|
{
|
||||||
if (wParam == reinterpret_cast<WPARAM>(_pEditView->getCurrentBuffer()))
|
Buffer* currentBuf = _pEditView->getCurrentBuffer();
|
||||||
addHotSpot(_pEditView);
|
if (wParam == reinterpret_cast<WPARAM>(currentBuf))
|
||||||
|
{
|
||||||
|
int urlAction = nppParam.getNppGUI()._styleURL;
|
||||||
|
if (urlAction != urlDisable && currentBuf->allowClickableLink())
|
||||||
|
{
|
||||||
|
addHotSpot(_pEditView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SCNotification scnN{};
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_GLOBALMODIFIED;
|
scnN.nmhdr.code = NPPN_GLOBALMODIFIED;
|
||||||
scnN.nmhdr.hwndFrom = reinterpret_cast<void*>(wParam);
|
scnN.nmhdr.hwndFrom = reinterpret_cast<void*>(wParam);
|
||||||
|
@ -188,7 +188,12 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
|
|
||||||
if (!_isFolding)
|
if (!_isFolding)
|
||||||
{
|
{
|
||||||
addHotSpot();
|
int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
|
||||||
|
Buffer* currentBuf = _pEditView->getCurrentBuffer();
|
||||||
|
if (urlAction != urlDisable && currentBuf->allowClickableLink())
|
||||||
|
{
|
||||||
|
addHotSpot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pDocMap)
|
if (_pDocMap)
|
||||||
@ -405,17 +410,22 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
NppGUI& nppGui = nppParam.getNppGUI();
|
NppGUI& nppGui = nppParam.getNppGUI();
|
||||||
|
|
||||||
|
Buffer* currentBuf = notifyView->getCurrentBuffer();
|
||||||
|
|
||||||
// replacement for obsolete custom SCN_SCROLLED
|
// replacement for obsolete custom SCN_SCROLLED
|
||||||
if (notification->updated & SC_UPDATE_V_SCROLL)
|
if (notification->updated & SC_UPDATE_V_SCROLL)
|
||||||
{
|
{
|
||||||
addHotSpot(notifyView);
|
int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
|
||||||
|
if (urlAction != urlDisable && currentBuf->allowClickableLink())
|
||||||
|
{
|
||||||
|
addHotSpot(notifyView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's searching/replacing, then do nothing
|
// if it's searching/replacing, then do nothing
|
||||||
if (nppParam._isFindReplacing)
|
if (nppParam._isFindReplacing)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Buffer* currentBuf = _pEditView->getCurrentBuffer();
|
|
||||||
if (notification->nmhdr.hwndFrom != _pEditView->getHSelf() && currentBuf->allowSmartHilite()) // notification come from unfocus view - both views ae visible
|
if (notification->nmhdr.hwndFrom != _pEditView->getHSelf() && currentBuf->allowSmartHilite()) // notification come from unfocus view - both views ae visible
|
||||||
{
|
{
|
||||||
if (nppGui._smartHiliteOnAnotherView)
|
if (nppGui._smartHiliteOnAnotherView)
|
||||||
@ -516,7 +526,12 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
// if it's searching/replacing, then do nothing
|
// if it's searching/replacing, then do nothing
|
||||||
if ((_linkTriggered && !nppParam._isFindReplacing) || notification->wParam == LINKTRIGGERED)
|
if ((_linkTriggered && !nppParam._isFindReplacing) || notification->wParam == LINKTRIGGERED)
|
||||||
{
|
{
|
||||||
addHotSpot();
|
int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL;
|
||||||
|
Buffer* currentBuf = _pEditView->getCurrentBuffer();
|
||||||
|
if (urlAction != urlDisable && currentBuf->allowClickableLink())
|
||||||
|
{
|
||||||
|
addHotSpot();
|
||||||
|
}
|
||||||
_linkTriggered = false;
|
_linkTriggered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user