Fix URL underline always black, invisible in dark themes

Fix #8405, close #8409
This commit is contained in:
Udo Hoffmann 2020-06-12 17:13:42 +02:00 committed by Don HO
parent fb5c30002f
commit f657618887
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
3 changed files with 11 additions and 2 deletions

View File

@ -2489,6 +2489,7 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view)
pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos);
if (!urlAction) return;
LRESULT indicFore = pView->execute(SCI_STYLEGETFORE, STYLE_DEFAULT);
pView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
pView->execute(SCI_SETTARGETRANGE, startPos, endPos);
int posFound = static_cast<int32_t>(pView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast<LPARAM>(URL_REG_EXPR)));
@ -2499,7 +2500,7 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view)
int end = int(pView->execute(SCI_GETTARGETEND));
int foundTextLen = end - start;
pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC);
pView->execute(SCI_SETINDICATORVALUE, 0);
pView->execute(SCI_SETINDICATORVALUE, indicFore);
pView->execute(SCI_INDICATORFILLRANGE, start, foundTextLen);
pView->execute(SCI_SETTARGETRANGE, posFound + foundTextLen, endPos);
posFound = static_cast<int32_t>(pView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast<LPARAM>(URL_REG_EXPR)));

View File

@ -525,6 +525,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
_pDocMap->reloadMap();
}
addHotSpot(_pEditView);
addHotSpot(_pNonEditView);
result = TRUE;
break;
}
@ -1657,9 +1660,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
//reset styler for change in Stylers.xml
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
_mainEditView.performGlobalStyles();
addHotSpot(& _mainEditView);
_subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType());
_subEditView.performGlobalStyles();
addHotSpot(& _subEditView);
_findReplaceDlg.updateFinderScintilla();

View File

@ -330,6 +330,9 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true);
execute(SCI_INDICSETHOVERSTYLE, URL_INDIC, INDIC_FULLBOX);
execute(SCI_INDICSETALPHA, URL_INDIC, 70);
execute(SCI_INDICSETFLAGS, URL_INDIC, SC_INDICFLAG_VALUEFORE);
if ((NppParameters::getInstance()).getNppGUI()._writeTechnologyEngine == directWriteTechnology)
execute(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE);