diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 1eb570600..30adf8208 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3683,9 +3683,11 @@ void Notepad_plus::command(int id) Buffer * buf = _pEditView->getCurrentBuffer(); UniMode um; + bool shoulBeDirty = true; switch (id) { case IDM_FORMAT_AS_UTF_8: + shoulBeDirty = buf->getUnicodeMode() != uni8Bit; um = uniCookie; break; @@ -3702,13 +3704,15 @@ void Notepad_plus::command(int id) break; default : // IDM_FORMAT_ANSI + shoulBeDirty = buf->getUnicodeMode() != uniCookie; um = uni8Bit; } if (buf->getUnicodeMode() != um) { buf->setUnicodeMode(um); - buf->setDirty(true); + if (shoulBeDirty) + buf->setDirty(true); } break; } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 14795a2c9..13ccaf243 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2451,6 +2451,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) const TCHAR *tahl = element->Attribute(TEXT("TagAttrHighLight")); if (tahl) _nppGUI._enableTagAttrsHilite = !lstrcmp(tahl, TEXT("yes")); + + tahl = element->Attribute(TEXT("HighLightNonHtmlZone")); + if (tahl) + _nppGUI._enableHiliteNonHTMLZone = !lstrcmp(tahl, TEXT("yes")); } } } @@ -3409,6 +3413,7 @@ bool NppParameters::writeGUIParams() childNode->InsertEndChild(TiXmlText(pStr)); (childNode->ToElement())->SetAttribute(TEXT("TagAttrHighLight"), _nppGUI._enableTagAttrsHilite?TEXT("yes"):TEXT("no")); + (childNode->ToElement())->SetAttribute(TEXT("HighLightNonHtmlZone"), _nppGUI._enableHiliteNonHTMLZone?TEXT("yes"):TEXT("no")); } else if (!lstrcmp(nm, TEXT("TaskList"))) @@ -3604,6 +3609,7 @@ bool NppParameters::writeGUIParams() { TiXmlElement * ele = insertGUIConfigBoolNode(GUIRoot, TEXT("TagsMatchHighLight"), _nppGUI._enableTagsMatchHilite); ele->SetAttribute(TEXT("TagAttrHighLight"), _nppGUI._enableTagAttrsHilite?TEXT("yes"):TEXT("no")); + ele->SetAttribute(TEXT("HighLightNonHtmlZone"), _nppGUI._enableHiliteNonHTMLZone?TEXT("yes"):TEXT("no")); } if (!rememberLastSessionExist) { diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index db83fc540..1fe0296a0 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -530,7 +530,7 @@ struct NppGUI NppGUI() : _toolBarStatus(TB_LARGE), _toolbarShow(true), _statusBarShow(true), _menuBarShow(true),\ _tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP), _splitterPos(POS_HORIZOTAL),\ _userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\ - _checkHistoryFiles(true) ,_enableSmartHilite(true), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true),\ + _checkHistoryFiles(true) ,_enableSmartHilite(true), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\ _isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\ _doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\ _autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\ @@ -579,7 +579,7 @@ struct NppGUI bool _enableSmartHilite; bool _enableTagsMatchHilite; bool _enableTagAttrsHilite; - //bool _saveOpenKeepInSameDir; + bool _enableHiliteNonHTMLZone; bool _styleMRU; // 0 : do nothing diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index 3ab20d8d7..517f5cfb9 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -116,8 +116,9 @@ bool XmlMatchedTagsHighlighter::getMatchedTagPos(int searchStart, int searchEnd, return false; // if the tag is found in non html zone, we skip it + const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); int idStyle = _pEditView->execute(SCI_GETSTYLEAT, ltPosOnR); - if (idStyle >= SCE_HJ_START) + if (idStyle >= SCE_HJ_START && !nppGUI._enableHiliteNonHTMLZone) { int start = (direction == search2Left)?foundPos.first:foundPos.second; int end = searchEnd; @@ -259,8 +260,9 @@ bool XmlMatchedTagsHighlighter::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos int caretPos = _pEditView->execute(SCI_GETCURRENTPOS); // if the tag is found in non html zone, then quit + const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); int idStyle = _pEditView->execute(SCI_GETSTYLEAT, caretPos); - if (idStyle >= SCE_HJ_START) + if (!nppGUI._enableHiliteNonHTMLZone && idStyle >= SCE_HJ_START) return false; int docLen = _pEditView->getCurrentDocLen(); @@ -444,9 +446,10 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr) // Detect the current lang type. It works only with html and xml LangType lang = (_pEditView->getCurrentBuffer())->getLangType(); + if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP) return; - + // Get the original targets and search options to restore after tag matching operation int originalStartPos = _pEditView->execute(SCI_GETTARGETSTART); int originalEndPos = _pEditView->execute(SCI_GETTARGETEND); diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index f09980226..9391f0dad 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -564,13 +564,14 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCSWITCHER, BM_SETCHECK, nppGUI._doTaskList, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0); - //::SendDlgItemMessage(_hSelf, IDC_CHECK_KEEPINSAMEDIR, BM_SETCHECK, nppGUI._saveOpenKeepInSameDir, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, nppGUI._styleMRU, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLSMARTHILITE, BM_SETCHECK, nppGUI._enableSmartHilite, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGSMATCHHILITE, BM_SETCHECK, nppGUI._enableTagsMatchHilite, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE, BM_SETCHECK, nppGUI._enableTagAttrsHilite, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE, BM_SETCHECK, nppGUI._enableHiliteNonHTMLZone, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); if (enableDlgTheme) @@ -718,6 +719,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATORTAGMATCH, 0, 0); } ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); return TRUE; } case IDC_CHECK_ENABLTAGATTRHILITE: @@ -730,6 +732,13 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara } return TRUE; } + + case IDC_CHECK_HIGHLITENONEHTMLZONE: + { + nppGUI._enableHiliteNonHTMLZone = !nppGUI._enableHiliteNonHTMLZone; + return TRUE; + } + case IDC_CHECK_STYLEMRU : { nppGUI._styleMRU = !nppGUI._styleMRU; diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index 5ddcacf23..3f12bb6b2 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -110,7 +110,7 @@ IntermediateDirectory="Release" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops;.\no_ms_shit.vsprops" - CharacterSet="1" + CharacterSet="2" WholeProgramOptimization="1" >