diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index ad634fb63..be7caada0 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -912,8 +912,12 @@ You can define several column markers by using white space to separate the diffe + + + + diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 876f5cb2d..8b2376fe1 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -1257,19 +1257,22 @@ void Notepad_plus::command(int id) styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5; const int strSize = FINDREPLACE_MAXLENGTH; - TCHAR text2Find[strSize]; - TCHAR text2Find2[strSize]; + TCHAR selectedText[strSize]; + TCHAR wordOnCaret[strSize]; - _pEditView->getGenericSelectedText(text2Find, strSize, false); - _pEditView->getGenericWordOnCaretPos(text2Find2, strSize); + _pEditView->getGenericSelectedText(selectedText, strSize, false); + _pEditView->getGenericWordOnCaretPos(wordOnCaret, strSize); - if (text2Find[0] == '\0') + if (selectedText[0] == '\0') { - _findReplaceDlg.markAll(text2Find2, styleID, true); + if (lstrlen(wordOnCaret) > 0) + { + _findReplaceDlg.markAll(wordOnCaret, styleID, true); + } } else { - _findReplaceDlg.markAll(text2Find, styleID, lstrlen(text2Find) == lstrlen(text2Find2)); + _findReplaceDlg.markAll(selectedText, styleID, lstrlen(selectedText) == lstrlen(wordOnCaret)); } } break; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 355d4f010..a805660d5 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4401,6 +4401,27 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) } } } + // + else if (!lstrcmp(nm, TEXT("MarkAll"))) + { + const TCHAR* val = element->Attribute(TEXT("matchCase")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._markAllCaseSensitive = true; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._markAllCaseSensitive = false; + } + + val = element->Attribute(TEXT("wholeWordOnly")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._markAllWordOnly = true; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._markAllWordOnly = false; + } + } // yes else if (!lstrcmp(nm, TEXT("SmartHighLight"))) { @@ -6323,6 +6344,14 @@ void NppParameters::createXmlTreeFromGUIParams() GUIConfigElement->SetAttribute(TEXT("searchEngineCustom"), _nppGUI._searchEngineCustom); } + // + { + TiXmlElement* GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MarkAll")); + GUIConfigElement->SetAttribute(TEXT("matchCase"), _nppGUI._markAllCaseSensitive ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("wholeWordOnly"), _nppGUI._markAllWordOnly ? TEXT("yes") : TEXT("no")); + } + // yes { TiXmlElement *GUIConfigElement = insertGUIConfigBoolNode(newGUIRoot, TEXT("SmartHighLight"), _nppGUI._enableSmartHilite); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index fb1e2d3c6..3f2969443 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -840,6 +840,9 @@ struct NppGUI final bool _smartHiliteUseFindSettings = false; bool _smartHiliteOnAnotherView = false; + bool _markAllCaseSensitive = false; + bool _markAllWordOnly = true; + bool _disableSmartHiliteTmp = false; bool _enableTagsMatchHilite = true; bool _enableTagAttrsHilite = true; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 620797e0b..7db333ce6 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -2021,14 +2021,18 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID, bool isWholeWordSelected) { - FindOption opt; - opt._isMatchCase = _options._isMatchCase; - // if whole word is selected for being colorized, isWholeWord option in Find/Replace dialog will be checked - // otherwise this option is false, because user may want to find the words contain the parts to search - opt._isWholeWord = isWholeWordSelected?_options._isWholeWord:false; - opt._str2Search = txt2find; + const NppGUI& nppGUI = NppParameters::getInstance().getNppGUI(); + FindOption markAllOpt; - int nbFound = processAll(ProcessMarkAllExt, &opt, true, NULL, styleID); + markAllOpt._isMatchCase = nppGUI._markAllCaseSensitive; + + // if whole word is selected for being colorized, isWholeWord setting in Preferences will be checked + // otherwise this option is false, because user may want to find the words contain the parts to search + markAllOpt._isWholeWord = isWholeWordSelected ? nppGUI._markAllWordOnly : false; + + markAllOpt._str2Search = txt2find; + + int nbFound = processAll(ProcessMarkAllExt, &markAllOpt, true, NULL, styleID); return nbFound; } diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index b0d897a20..39eed9760 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -222,17 +222,20 @@ IDD_PREFERENCE_SUB_HIGHLIGHTING DIALOGEX 0, 0, 455, 185 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Smart Highlighting",IDC_SMARTHILITING_STATIC,147,21,155,81,BS_CENTER - CONTROL "Enable",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,31,142,10 - CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,45,142,10 - CONTROL "Match whole word only",IDC_CHECK_SMARTHILITEWHOLEWORDONLY, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,58,142,10 - CONTROL "Use Find dialog settings",IDC_CHECK_SMARTHILITEUSEFINDSETTINGS, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,72,142,10 - CONTROL "Highlight another view",IDC_CHECK_SMARTHILITEANOTHERRVIEW, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,86,142,10 - - GROUPBOX "Highlight Matching Tags",IDC_TAGMATCHEDHILITE_STATIC,147,110,155,55,BS_CENTER - CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,120,140,10 - CONTROL "Highlight tag attributes",IDC_CHECK_ENABLTAGATTRHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,134,140,10 - CONTROL "Highlight comment/php/asp zone",IDC_CHECK_HIGHLITENONEHTMLZONE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,148,140,10 + GROUPBOX "Mark All",IDC_MARKALL_STATIC,62,29,155,45,BS_CENTER + CONTROL "Match case",IDC_CHECK_MARKALLCASESENSITIVE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,70,42,142,10 + CONTROL "Match whole word only",IDC_CHECK_MARKALLWHOLEWORDONLY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,70,55,142,10 + GROUPBOX "Smart Highlighting",IDC_SMARTHILITING_STATIC,226,29,172,108,BS_CENTER + CONTROL "Enable",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,234,39,142,10 + CONTROL "Highlight another view",IDC_CHECK_SMARTHILITEANOTHERRVIEW,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,234,55,142,10 + GROUPBOX "Matching", IDC_SMARTHILITEMATCHING_STATIC,233,74,155,55,BS_CENTER + CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,241,86,142,10 + CONTROL "Match whole word only",IDC_CHECK_SMARTHILITEWHOLEWORDONLY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,241,99,142,10 + CONTROL "Use Find dialog settings",IDC_CHECK_SMARTHILITEUSEFINDSETTINGS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,241,113,142,10 + GROUPBOX "Highlight Matching Tags",IDC_TAGMATCHEDHILITE_STATIC,62,82,155,55,BS_CENTER + CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,71,92,140,10 + CONTROL "Highlight tag attributes",IDC_CHECK_ENABLTAGATTRHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,71,106,140,10 + CONTROL "Highlight comment/php/asp zone",IDC_CHECK_HIGHLITENONEHTMLZONE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,71,120,140,10 END diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index fae80679d..0d38594d3 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -2143,6 +2143,9 @@ INT_PTR CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP { case WM_INITDIALOG : { + ::SendDlgItemMessage(_hSelf, IDC_CHECK_MARKALLCASESENSITIVE, BM_SETCHECK, nppGUI._markAllCaseSensitive, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_MARKALLWHOLEWORDONLY, BM_SETCHECK, nppGUI._markAllWordOnly, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLSMARTHILITE, BM_SETCHECK, nppGUI._enableSmartHilite, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE, BM_SETCHECK, nppGUI._smartHiliteCaseSensitive, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITEWHOLEWORDONLY, BM_SETCHECK, nppGUI._smartHiliteWordOnly, 0); @@ -2171,7 +2174,23 @@ INT_PTR CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP case WM_COMMAND : { switch (wParam) - { + { + case IDC_CHECK_MARKALLCASESENSITIVE: + { + nppGUI._markAllCaseSensitive = isCheckedOrNot(IDC_CHECK_MARKALLCASESENSITIVE); + HWND grandParent = ::GetParent(_hParent); + ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); + return TRUE; + } + + case IDC_CHECK_MARKALLWHOLEWORDONLY: + { + nppGUI._markAllWordOnly = isCheckedOrNot(IDC_CHECK_MARKALLWHOLEWORDONLY); + HWND grandParent = ::GetParent(_hParent); + ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); + return TRUE; + } + case IDC_CHECK_ENABLSMARTHILITE: { nppGUI._enableSmartHilite = !nppGUI._enableSmartHilite; @@ -2201,6 +2220,7 @@ INT_PTR CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); return TRUE; } + case IDC_CHECK_SMARTHILITEWHOLEWORDONLY: { nppGUI._smartHiliteWordOnly = isCheckedOrNot(IDC_CHECK_SMARTHILITEWHOLEWORDONLY); @@ -2213,6 +2233,7 @@ INT_PTR CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); return TRUE; } + case IDC_CHECK_SMARTHILITEUSEFINDSETTINGS: { nppGUI._smartHiliteUseFindSettings = isCheckedOrNot(IDC_CHECK_SMARTHILITEUSEFINDSETTINGS); @@ -2227,6 +2248,7 @@ INT_PTR CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); return TRUE; } + case IDC_CHECK_SMARTHILITEANOTHERRVIEW: { nppGUI._smartHiliteOnAnotherView = isCheckedOrNot(IDC_CHECK_SMARTHILITEANOTHERRVIEW); diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 99346e6b9..b547546bf 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -203,15 +203,19 @@ #define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SUB_MISC + 41) #define IDC_REMEMBEREDITVIEWPERFILE_STATIC (IDD_PREFERENCE_SUB_MISC + 42) #define IDC_EDIT_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SUB_MISC + 43) - + #define IDC_DOCUMENTPEEK_STATIC (IDD_PREFERENCE_SUB_MISC + 44) #define IDC_CHECK_ENABLEDOCPEEKER (IDD_PREFERENCE_SUB_MISC + 45) #define IDC_CHECK_ENABLEDOCPEEKONMAP (IDD_PREFERENCE_SUB_MISC + 46) #define IDC_COMBO_FILEUPDATECHOICE (IDD_PREFERENCE_SUB_MISC + 47) #define IDC_CHECK_DIRECTWRITE_ENABLE (IDD_PREFERENCE_SUB_MISC + 49) #define IDC_CHECK_CLICKABLELINK_FULLBOXMODE (IDD_PREFERENCE_SUB_MISC + 50) + #define IDC_MARKALL_STATIC (IDD_PREFERENCE_SUB_MISC + 51) + #define IDC_CHECK_MARKALLCASESENSITIVE (IDD_PREFERENCE_SUB_MISC + 52) + #define IDC_CHECK_MARKALLWHOLEWORDONLY (IDD_PREFERENCE_SUB_MISC + 53) + #define IDC_SMARTHILITEMATCHING_STATIC (IDD_PREFERENCE_SUB_MISC + 54) #define IDC_CHECK_MUTE_SOUNDS (IDD_PREFERENCE_SUB_MISC + 60) - + #define IDD_PREFERENCE_SUB_NEWDOCUMENT 6400 //(IDD_PREFERENCE_BOX + 400) #define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_SUB_NEWDOCUMENT + 1) #define IDC_RADIO_F_WIN (IDD_PREFERENCE_SUB_NEWDOCUMENT + 2)