diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index c2284e3f..3a8695b9 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1018,6 +1018,7 @@ You can define several column markers by using white space to separate the diffe + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index e79c75f6..7b477deb 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2503,15 +2503,15 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view) ScintillaEditView* pView = view ? view : _pEditView; int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL; - LPARAM indicStyle = (urlAction == 2) ? INDIC_PLAIN : INDIC_HIDDEN; - + LPARAM indicStyle = (urlAction == urlNoUnderLineFg) || (urlAction == urlNoUnderLineBg) ? INDIC_HIDDEN : INDIC_PLAIN; + LPARAM indicHoverStyle = (urlAction == urlNoUnderLineBg) || (urlAction == urlUnderLineBg) ? INDIC_FULLBOX : INDIC_EXPLORERLINK; LPARAM indicStyleCur = pView->execute(SCI_INDICGETSTYLE, URL_INDIC); LPARAM indicHoverStyleCur = pView->execute(SCI_INDICGETHOVERSTYLE, URL_INDIC); - if ((indicStyleCur != indicStyle) || (indicHoverStyleCur != INDIC_FULLBOX)) + if ((indicStyleCur != indicStyle) || (indicHoverStyleCur != indicHoverStyle)) { pView->execute(SCI_INDICSETSTYLE, URL_INDIC, indicStyle); - pView->execute(SCI_INDICSETHOVERSTYLE, URL_INDIC, INDIC_FULLBOX); + pView->execute(SCI_INDICSETHOVERSTYLE, URL_INDIC, indicHoverStyle); pView->execute(SCI_INDICSETALPHA, URL_INDIC, 70); pView->execute(SCI_INDICSETFLAGS, URL_INDIC, SC_INDICFLAG_VALUEFORE); } @@ -2521,25 +2521,32 @@ void Notepad_plus::addHotSpot(ScintillaEditView* view) pView->getVisibleStartAndEndPosition(&startPos, &endPos); if (startPos >= endPos) return; pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC); - pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos); - if (!urlAction) return; + if (urlAction == urlDisable) + { + pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos); + return; + } LRESULT indicFore = pView->execute(SCI_STYLEGETFORE, STYLE_DEFAULT); + pView->execute(SCI_SETINDICATORVALUE, indicFore); + 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))); while (posFound != -1 && posFound != -2) { - int start = int(pView->execute(SCI_GETTARGETSTART)); int end = int(pView->execute(SCI_GETTARGETEND)); - int foundTextLen = end - start; - pView->execute(SCI_SETINDICATORCURRENT, URL_INDIC); - pView->execute(SCI_SETINDICATORVALUE, indicFore); - pView->execute(SCI_INDICATORFILLRANGE, start, foundTextLen); - pView->execute(SCI_SETTARGETRANGE, posFound + foundTextLen, endPos); + int foundTextLen = end - posFound; + if (posFound > startPos) + pView->execute(SCI_INDICATORCLEARRANGE, startPos, posFound - startPos); + pView->execute(SCI_INDICATORFILLRANGE, posFound, foundTextLen); + startPos = posFound + foundTextLen; + pView->execute(SCI_SETTARGETRANGE, startPos, endPos); posFound = static_cast(pView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast(URL_REG_EXPR))); } + if (endPos > startPos) + pView->execute(SCI_INDICATORCLEARRANGE, startPos, endPos - startPos); } bool Notepad_plus::isConditionExprLine(int lineNumber) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 2593e0b4..f51845b7 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4394,12 +4394,9 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) const TCHAR* val = n->Value(); if (val) { - if (!lstrcmp(val, TEXT("1"))) - _nppGUI._styleURL = 1; - else if (!lstrcmp(val, TEXT("2"))) - _nppGUI._styleURL = 2; - else - _nppGUI._styleURL = 0; + int const i = generic_atoi (val); + if ((i >= urlMin) && (i <= urlMax)) + _nppGUI._styleURL = urlMode(i); } } } @@ -5811,15 +5808,11 @@ void NppParameters::createXmlTreeFromGUIParams() // 2 { - const TCHAR *pStr = TEXT("0"); - if (_nppGUI._styleURL == 1) - pStr = TEXT("1"); - else if (_nppGUI._styleURL == 2) - pStr = TEXT("2"); - + TCHAR szStr [12] = TEXT("0"); + generic_itoa(_nppGUI._styleURL, szStr, 10); TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("URL")); - GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + GUIConfigElement->InsertEndChild(TiXmlText(szStr)); } // diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 70bc61a5..3dd28103 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -92,6 +92,9 @@ enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2}; enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2}; enum MultiInstSetting {monoInst = 0, multiInstOnSession = 1, multiInst = 2}; enum writeTechnologyEngine {defaultTechnology = 0, directWriteTechnology = 1}; +enum urlMode {urlDisable = 0, urlNoUnderLineFg, urlUnderLineFg, urlNoUnderLineBg, urlUnderLineBg, + urlMin = urlDisable, + urlMax = urlUnderLineBg}; const int LANG_INDEX_INSTR = 0; const int LANG_INDEX_INSTR2 = 1; @@ -843,12 +846,7 @@ struct NppGUI final writeTechnologyEngine _writeTechnologyEngine = defaultTechnology; bool _isWordCharDefault = true; std::string _customWordChars; - - // 0 : do nothing - // 1 : don't draw underline - // 2 : draw underline - int _styleURL = 2; - + urlMode _styleURL = urlUnderLineFg; NewDocDefaultSettings _newDocDefaultSettings; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 88edcbd4..1542c95d 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -130,15 +130,17 @@ BEGIN CONTROL "Use DirectWrite (May improve rendering special characters, need to restart Notepad++)",IDC_CHECK_DIRECTWRITE_ENABLE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,188,377,10 CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10 CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10 - COMBOBOX IDC_COMBO_FILEUPDATECHOICE,267, 60,140,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,76,140,10 - CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,88,140,10 + CONTROL "Enable fullbox mode",IDC_CHECK_CLICKABLELINK_FULLBOXMODE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,41,140,10 + + COMBOBOX IDC_COMBO_FILEUPDATECHOICE,267, 73,140,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,89,140,10 + CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,101,140,10 EDITTEXT IDC_EDIT_SESSIONFILEEXT,381,135,34,14,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_WORKSPACEFILEEXT,381,152,34,14,ES_AUTOHSCROLL GROUPBOX "Document Switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,37,4,155,39,BS_CENTER - GROUPBOX "Clickable Link Settings",IDC_CLICKABLELINK_STATIC,259,4,155,39,BS_CENTER + GROUPBOX "Clickable Link Settings",IDC_CLICKABLELINK_STATIC,259,4,155,52,BS_CENTER GROUPBOX "Document Peeker",IDC_DOCUMENTPEEK_STATIC,37,47,155,39,BS_CENTER - GROUPBOX "File Status Auto-Detection",IDC_FILEAUTODETECTION_STATIC,259,47,155,60,BS_CENTER + GROUPBOX "File Status Auto-Detection",IDC_FILEAUTODETECTION_STATIC,259,60,155,60,BS_CENTER RTEXT "Session file ext.:",IDC_SESSIONFILEEXT_STATIC,271,138,108,8 RTEXT "Workspace file ext.:",IDC_WORKSPACEFILEEXT_STATIC,271,155,108,8 END diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index a996f751..11488677 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -919,26 +919,15 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE); - BOOL linkEnable = FALSE; - BOOL dontUnderline = FALSE; - BOOL dontUnderlineState = FALSE; - if (nppGUI._styleURL == 1) - { - linkEnable = TRUE; - dontUnderline = TRUE; - dontUnderlineState = TRUE; - - } - else if (nppGUI._styleURL == 2) - { - linkEnable = TRUE; - dontUnderline = FALSE; - dontUnderlineState = TRUE; - } - + BOOL linkEnable = nppGUI._styleURL != urlDisable; + BOOL dontUnderline = (nppGUI._styleURL == urlNoUnderLineFg) || (nppGUI._styleURL == urlNoUnderLineBg); + BOOL roundBoxMode = (nppGUI._styleURL == urlNoUnderLineBg) || (nppGUI._styleURL == urlUnderLineBg); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_ENABLE, BM_SETCHECK, linkEnable, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE, BM_SETCHECK, dontUnderline, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), dontUnderlineState); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE, BM_SETCHECK, roundBoxMode, 0); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), linkEnable); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE), linkEnable); ::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_SETTEXT, 0, reinterpret_cast(nppGUI._definedSessionExt.c_str())); ::SendDlgItemMessage(_hSelf, IDC_EDIT_WORKSPACEFILEEXT, WM_SETTEXT, 0, reinterpret_cast(nppGUI._definedWorkspaceExt.c_str())); @@ -1010,19 +999,28 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { bool isChecked = isCheckedOrNot(IDC_CHECK_CLICKABLELINK_ENABLE); if (!isChecked) + { ::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE, BM_SETCHECK, BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE, BM_SETCHECK, BST_UNCHECKED, 0); + } ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), isChecked); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE), isChecked); - nppGUI._styleURL = isChecked?2:0; + nppGUI._styleURL = isChecked ? urlUnderLineFg : urlDisable; HWND grandParent = ::GetParent(_hParent); ::SendMessage(grandParent, NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); } return TRUE; case IDC_CHECK_CLICKABLELINK_NOUNDERLINE: + case IDC_CHECK_CLICKABLELINK_FULLBOXMODE: { - bool isChecked = isCheckedOrNot(IDC_CHECK_CLICKABLELINK_NOUNDERLINE); - nppGUI._styleURL = isChecked?1:2; + bool isNoUnderline = isCheckedOrNot(IDC_CHECK_CLICKABLELINK_NOUNDERLINE); + bool isRoundBoxMode = isCheckedOrNot(IDC_CHECK_CLICKABLELINK_FULLBOXMODE); + if (isRoundBoxMode) + nppGUI._styleURL = isNoUnderline ? urlNoUnderLineBg : urlUnderLineBg; + else + nppGUI._styleURL = isNoUnderline ? urlNoUnderLineFg : urlUnderLineFg; HWND grandParent = ::GetParent(_hParent); ::SendMessage(grandParent, NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0); } diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index b98faceb..2eb66cce 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -209,6 +209,7 @@ #define IDC_CHECK_ENABLEDOCPEEKONMAP (IDD_PREFERENCE_SETTING_BOX + 46) #define IDC_COMBO_FILEUPDATECHOICE (IDD_PREFERENCE_SETTING_BOX + 47) #define IDC_CHECK_DIRECTWRITE_ENABLE (IDD_PREFERENCE_SETTING_BOX + 49) + #define IDC_CHECK_CLICKABLELINK_FULLBOXMODE (IDD_PREFERENCE_SETTING_BOX + 50) #define IDD_PREFERENCE_NEWDOCSETTING_BOX 6400 //(IDD_PREFERENCE_BOX + 400) #define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 1) diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 4e20a190..f8f9035a 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -293,6 +293,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_POINTCHARACTER 19 #define INDIC_GRADIENT 20 #define INDIC_GRADIENTCENTRE 21 +#define INDIC_EXPLORERLINK 22 #define INDIC_CONTAINER 8 #define INDIC_IME 32 #define INDIC_IME_MAX 35 diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index 887e7754..0cebe407 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -1814,11 +1814,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi ((model.hoverIndicatorPos >= ts.start + posLineStart) && (model.hoverIndicatorPos <= ts.end() + posLineStart)); if (hover) { - if (indicator.sacHover.style == INDIC_TEXTFORE) { + if ((indicator.sacHover.style == INDIC_TEXTFORE) || (indicator.sacHover.style == INDIC_EXPLORERLINK)) { textFore = indicator.sacHover.fore; } } else { - if (indicator.sacNormal.style == INDIC_TEXTFORE) { + if ((indicator.sacNormal.style == INDIC_TEXTFORE) || (indicator.sacNormal.style == INDIC_EXPLORERLINK)) { if (indicator.Flags() & SC_INDICFLAG_VALUEFORE) textFore = ColourDesired(indicatorValue & SC_INDICVALUEMASK); else diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx index 5210c7eb..3032bae3 100644 --- a/scintilla/src/Indicator.cxx +++ b/scintilla/src/Indicator.cxx @@ -212,7 +212,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r }; surface->Polygon(pts, std::size(pts), sacDraw.fore, sacDraw.fore); } - } else { // Either INDIC_PLAIN or unknown + } else { // Either INDIC_PLAIN, INDIC_EXPLORERLINK or unknown surface->MoveTo(irc.left, ymid); surface->LineTo(irc.right, ymid); } diff --git a/scintilla/src/Indicator.h b/scintilla/src/Indicator.h index 7e6f40b9..8f2bb8c4 100644 --- a/scintilla/src/Indicator.h +++ b/scintilla/src/Indicator.h @@ -43,7 +43,7 @@ public: return !(sacNormal == sacHover); } bool OverridesTextFore() const noexcept { - return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE; + return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE || sacNormal.style == INDIC_EXPLORERLINK || sacHover.style == INDIC_EXPLORERLINK; } int Flags() const noexcept { return attributes;