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); pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos);
if (!urlAction) return; if (!urlAction) return;
LRESULT indicFore = pView->execute(SCI_STYLEGETFORE, STYLE_DEFAULT);
pView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX); pView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
pView->execute(SCI_SETTARGETRANGE, startPos, endPos); 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))); 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 end = int(pView->execute(SCI_GETTARGETEND));
int foundTextLen = end - start; int foundTextLen = end - start;
pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC); 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_INDICATORFILLRANGE, start, foundTextLen);
pView->execute(SCI_SETTARGETRANGE, posFound + foundTextLen, endPos); 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))); 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(); _pDocMap->reloadMap();
} }
addHotSpot(_pEditView);
addHotSpot(_pNonEditView);
result = TRUE; result = TRUE;
break; break;
} }
@ -1657,9 +1660,11 @@ 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);
_findReplaceDlg.updateFinderScintilla(); _findReplaceDlg.updateFinderScintilla();

View File

@ -329,7 +329,10 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true);
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true);
execute(SCI_INDICSETHOVERSTYLE, URL_INDIC, INDIC_FULLBOX); 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) if ((NppParameters::getInstance()).getNppGUI()._writeTechnologyEngine == directWriteTechnology)
execute(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE); execute(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE);