From f657618887ecb2382472f459a7fa32838c30f612 Mon Sep 17 00:00:00 2001 From: Udo Hoffmann Date: Fri, 12 Jun 2020 17:13:42 +0200 Subject: [PATCH] Fix URL underline always black, invisible in dark themes Fix #8405, close #8409 --- PowerEditor/src/Notepad_plus.cpp | 3 ++- PowerEditor/src/NppBigSwitch.cpp | 5 +++++ PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 853ac7ac1..834e61488 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -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(pView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast(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(pView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast(URL_REG_EXPR))); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 66a150b06..6ed455665 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -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(); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index e7f0d518b..a8022946e 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -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_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) execute(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE);