diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index cd1604c8..5dc567c0 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -820,8 +820,13 @@ BOOL Notepad_plus::notify(SCNotification *notification) else { // Double click with no modifiers // Check wether cursor is within URL - int startPos = 0, endPos = 0; - if (!notifyView->getIndicatorRange(URL_INDIC, &startPos, &endPos)) + auto indicMsk = notifyView->execute(SCI_INDICATORALLONFOR, notification->position); + if (!(indicMsk & (1 << URL_INDIC))) + break; + + auto startPos = notifyView->execute(SCI_INDICATORSTART, URL_INDIC, notification->position); + auto endPos = notifyView->execute(SCI_INDICATOREND, URL_INDIC, notification->position); + if ((notification->position < startPos) || (notification->position > endPos)) break; // WM_LBUTTONUP goes to opening browser instead of Scintilla here, because the mouse is not captured. diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 7fcb5543..0a01ec6a 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -3327,6 +3327,22 @@ void ScintillaEditView::foldChanged(size_t line, int levelNow, int levelPrev) } } +bool ScintillaEditView::getIndicatorRange(int indicatorNumber, int *from, int *to, int *cur) +{ + int curPos = static_cast(execute(SCI_GETCURRENTPOS)); + int indicMsk = static_cast(execute(SCI_INDICATORALLONFOR, curPos)); + if (!(indicMsk & (1 << indicatorNumber))) + return false; + int startPos = static_cast(execute(SCI_INDICATORSTART, indicatorNumber, curPos)); + int endPos = static_cast(execute(SCI_INDICATOREND, indicatorNumber, curPos)); + if ((curPos < startPos) || (curPos > endPos)) + return false; + if (from) *from = startPos; + if (to) *to = endPos; + if (cur) *cur = curPos; + return true; +}; + void ScintillaEditView::scrollPosToCenter(size_t pos) { diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index a200990d..93c10606 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -559,20 +559,7 @@ public: execute(SCI_INDICATORCLEARRANGE, docStart, docEnd-docStart); }; - bool getIndicatorRange(int indicatorNumber, int *from = NULL, int *to = NULL, int *cur = NULL) { - int curPos = static_cast(execute(SCI_GETCURRENTPOS)); - int indicMsk = static_cast(execute(SCI_INDICATORALLONFOR, curPos)); - if (!(indicMsk & (1 << indicatorNumber))) - return false; - int startPos = static_cast(execute(SCI_INDICATORSTART, indicatorNumber, curPos)); - int endPos = static_cast(execute(SCI_INDICATOREND, indicatorNumber, curPos)); - if ((curPos < startPos) || (curPos > endPos)) - return false; - if (from) *from = startPos; - if (to) *to = endPos; - if (cur) *cur = curPos; - return true; - }; + bool getIndicatorRange(int indicatorNumber, int *from = NULL, int *to = NULL, int *cur = NULL); static LanguageName langNames[L_EXTERNAL+1];