diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index faa1fea1..34407a3b 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -323,6 +323,33 @@ const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UI return _multiByteStr; } +const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UINT codepage, long *mstart, long *mend) +{ + if (!_multiByteStr) + { + _multiByteStr = new char[initSize]; + _multiByteAllocLen = initSize; + } + + int len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, 0, NULL, NULL); + if (len > 0) + { + if (len > int(_multiByteAllocLen)) + { + delete [] _multiByteStr; + _multiByteAllocLen = len; + _multiByteStr = new char[_multiByteAllocLen]; + } + WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, len, NULL, NULL); + *mstart = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mstart, _multiByteStr, 0, NULL, NULL); + *mend = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mend, _multiByteStr, 0, NULL, NULL); + } + else + _multiByteStr[0] = 0; + + return _multiByteStr; +} + std::wstring string2wstring(const std::string & rString, UINT codepage) { int len = MultiByteToWideChar(codepage, 0, rString.c_str(), -1, NULL, 0); diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index 5eaf168c..6bbb79d5 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -109,6 +109,7 @@ public: const wchar_t * char2wchar(const char* mbStr, UINT codepage); const wchar_t * char2wchar(const char * mbcs2Convert, UINT codepage, int *mstart, int *mend); const char * wchar2char(const wchar_t* wcStr, UINT codepage); + const char * wchar2char(const wchar_t * wcStr, UINT codepage, long *mstart, long *mend); protected: WcharMbcsConvertor() : _multiByteStr(NULL), _wideCharStr(NULL), _multiByteAllocLen(0), _wideCharAllocLen(0), initSize(1024) { diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index c87a68ce..e5048481 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3306,19 +3306,7 @@ void Notepad_plus::command(int id) _findReplaceDlg.processFindNext(text2Find, &op); break; } - case IDM_SEARCH_MARKALL : - { - const int strSize = FINDREPLACE_MAXLENGTH; - TCHAR text2Find[strSize]; - _pEditView->getGenericSelectedText(text2Find, strSize); - FindOption op; - op._isWholeWord = false; - //op._whichDirection = (id == IDM_SEARCH_VOLATILE_FINDNEXT?DIR_DOWN:DIR_UP); - _findReplaceDlg.markAll(text2Find); - - break; - } case IDM_SEARCH_UNMARKALL : { @@ -3326,6 +3314,64 @@ void Notepad_plus::command(int id) break; } + case IDM_SEARCH_MARKALLEXT1 : + case IDM_SEARCH_MARKALLEXT2 : + case IDM_SEARCH_MARKALLEXT3 : + case IDM_SEARCH_MARKALLEXT4 : + case IDM_SEARCH_MARKALLEXT5 : + { + int styleID; + if (id == IDM_SEARCH_MARKALLEXT1) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1; + else if (id == IDM_SEARCH_MARKALLEXT2) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2; + else if (id == IDM_SEARCH_MARKALLEXT3) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3; + else if (id == IDM_SEARCH_MARKALLEXT4) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4; + else // (id == IDM_SEARCH_MARKALLEXT5) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5; + + const int strSize = FINDREPLACE_MAXLENGTH; + TCHAR text2Find[strSize]; + _pEditView->getGenericSelectedText(text2Find, strSize); + + _findReplaceDlg.markAll(text2Find, styleID); + + break; + } + case IDM_SEARCH_UNMARKALLEXT1 : + case IDM_SEARCH_UNMARKALLEXT2 : + case IDM_SEARCH_UNMARKALLEXT3 : + case IDM_SEARCH_UNMARKALLEXT4 : + case IDM_SEARCH_UNMARKALLEXT5 : + { + int styleID; + if (id == IDM_SEARCH_UNMARKALLEXT1) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1; + else if (id == IDM_SEARCH_UNMARKALLEXT2) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2; + else if (id == IDM_SEARCH_UNMARKALLEXT3) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3; + else if (id == IDM_SEARCH_UNMARKALLEXT4) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4; + else // (id == IDM_SEARCH_UNMARKALLEXT5) + styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5; + + _pEditView->clearIndicator(styleID); + break; + } + + case IDM_SEARCH_CLEARALLMARKS : + { + _pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT1); + _pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT2); + _pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT3); + _pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT4); + _pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT5); + break; + } + case IDM_SEARCH_GOTOLINE : { bool isFirstTime = !_goToLineDlg.isCreated(); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index f2677e7d..31be6c22 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -249,13 +249,31 @@ BEGIN MENUITEM "Find &Previous", IDM_SEARCH_FINDPREV MENUITEM "Find (volatile) Next", IDM_SEARCH_VOLATILE_FINDNEXT MENUITEM "Find (volatile) Previous", IDM_SEARCH_VOLATILE_FINDPREV - MENUITEM "Mark all", IDM_SEARCH_MARKALL - MENUITEM "Unmark all", IDM_SEARCH_UNMARKALL MENUITEM "&Replace...", IDM_SEARCH_REPLACE MENUITEM "&Incremental Search...", IDM_SEARCH_FINDINCREMENT MENUITEM "&Go to...", IDM_SEARCH_GOTOLINE - MENUITEM SEPARATOR MENUITEM "Go to matching brace", IDM_SEARCH_GOTOMATCHINGBRACE + MENUITEM SEPARATOR + + POPUP "Mark all with..." + BEGIN + MENUITEM "Mark all with the 1st style", IDM_SEARCH_MARKALLEXT1 + MENUITEM "Mark all with the 2nd style", IDM_SEARCH_MARKALLEXT2 + MENUITEM "Mark all with the 3rd style", IDM_SEARCH_MARKALLEXT3 + MENUITEM "Mark all with the 4th style", IDM_SEARCH_MARKALLEXT4 + MENUITEM "Mark all with the 5th style", IDM_SEARCH_MARKALLEXT5 + END + POPUP "Unark all with..." + BEGIN + MENUITEM "Unmark all the 1st style", IDM_SEARCH_UNMARKALLEXT1 + MENUITEM "Unmark all the 2nd style", IDM_SEARCH_UNMARKALLEXT2 + MENUITEM "Unmark all the 3rd style", IDM_SEARCH_UNMARKALLEXT3 + MENUITEM "Unmark all the 4th style", IDM_SEARCH_UNMARKALLEXT4 + MENUITEM "Unmark all the 5th style", IDM_SEARCH_UNMARKALLEXT5 + MENUITEM "Clear all marks", IDM_SEARCH_CLEARALLMARKS + END + + MENUITEM SEPARATOR MENUITEM "Toggle Bookmark" , IDM_SEARCH_TOGGLE_BOOKMARK MENUITEM "Next Bookmark", IDM_SEARCH_NEXT_BOOKMARK diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index bdc4b385..e6a710d1 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -653,36 +653,37 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP case WM_ACTIVATE : { - CharacterRange cr = (*_ppEditView)->getSelection(); - int nbSelected = cr.cpMax - cr.cpMin; - - int checkVal; - if (nbSelected <= 64) + if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) { - checkVal = BST_UNCHECKED; - _isInSelection = false; + CharacterRange cr = (*_ppEditView)->getSelection(); + int nbSelected = cr.cpMax - cr.cpMin; + + int checkVal; + if (nbSelected <= 1024) + { + checkVal = BST_UNCHECKED; + _isInSelection = false; + } + else + { + checkVal = BST_CHECKED; + _isInSelection = true; + } + + // Searching/replacing in column selection is not allowed + if ((*_ppEditView)->execute(SCI_GETSELECTIONMODE) == SC_SEL_RECTANGLE) + { + checkVal = BST_UNCHECKED; + _isInSelection = false; + nbSelected = 0; + } + ::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected); + ::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, checkVal, 0); } - else - { - checkVal = BST_CHECKED; - _isInSelection = true; - } - - // Searching/replacing in column selection is not allowed - if ((*_ppEditView)->execute(SCI_GETSELECTIONMODE) == SC_SEL_RECTANGLE) - { - checkVal = BST_UNCHECKED; - _isInSelection = false; - nbSelected = 0; - } - - ::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, checkVal, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected); - - + if (isCheckedOrNot(IDC_TRANSPARENT_LOSSFOCUS_RADIO)) { - if (wParam == WA_INACTIVE) + if (LOWORD(wParam) == WA_INACTIVE) { int percent = ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); (NppParameters::getInstance())->SetTransparent(_hSelf, percent); @@ -1218,10 +1219,15 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl return processFindNext(txt2find); //after replacing, find the next section for selection } -int FindReplaceDlg::markAll(const TCHAR *txt2find) + +int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID) { _doStyleFoundToken = true; - int nbFound = processAll(ProcessMarkAll, txt2find, NULL, true, NULL); + FindOption opt; + opt._isMatchCase = true; + opt._isWholeWord = false; + + int nbFound = processAll(ProcessMarkAllExt, txt2find, NULL, true, NULL, &opt, styleID); return nbFound; } @@ -1234,13 +1240,15 @@ int FindReplaceDlg::markAll2(const TCHAR *txt2find) return nbFound; } + + int FindReplaceDlg::markAllInc(const TCHAR *txt2find, FindOption *opt) { int nbFound = processAll(ProcessMarkAll_IncSearch, txt2find, NULL, true, NULL, opt); return nbFound; } -int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire, const TCHAR *fileName, FindOption *opt) +int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire, const TCHAR *fileName, FindOption *opt, int colourStyleID) { FindOption *pOptions = opt?opt:&_options; @@ -1282,10 +1290,16 @@ int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const endPosition = cr.cpMax; } - return processRange(op, txt2find, txt2replace, startPosition, endPosition, fileName, opt); + if (ProcessMarkAllExt && colourStyleID != -1) + { + startPosition = 0; + endPosition = docLength; + } + + return processRange(op, txt2find, txt2replace, startPosition, endPosition, fileName, opt, colourStyleID); } -int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName, FindOption *opt) +int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName, FindOption *opt, int colourStyleID) { int nbProcessed = 0; @@ -1360,7 +1374,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con - if (op == ProcessMarkAll) //if marking, check if purging is needed + if (op == ProcessMarkAll && colourStyleID == -1) //if marking, check if purging is needed { if (_doPurge) { if (_doMarkLine) @@ -1473,6 +1487,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con } break; } + + case ProcessMarkAllExt: + { + (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, colourStyleID); + (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen); + break; + } case ProcessMarkAll_2: { diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 3817b3f6..2d843bd6 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -54,7 +54,7 @@ struct TargetRange { }; enum SearchType { FindNormal, FindExtended, FindRegex }; -enum ProcessOperation { ProcessFindAll, ProcessReplaceAll, ProcessCountAll, ProcessMarkAll, ProcessMarkAll_2, ProcessMarkAll_IncSearch }; +enum ProcessOperation { ProcessFindAll, ProcessReplaceAll, ProcessCountAll, ProcessMarkAll, ProcessMarkAll_2, ProcessMarkAll_IncSearch, ProcessMarkAllExt }; struct FindOption { bool _isWholeWord; @@ -149,13 +149,14 @@ public: void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) { _pMainFoundInfos->push_back(fi); - _pMainMarkings->push_back(mi); std::generic_string str = TEXT("\tLine "); TCHAR lnb[16]; wsprintf(lnb, TEXT("%d"), lineNb); str += lnb; str += TEXT(": "); + mi._start += str.length(); + mi._end += str.length(); str += foundline; if (str.length() >= SC_SEARCHRESULT_LINEBUFFERMAXLENGTH) @@ -165,8 +166,9 @@ public: str += endOfLongLine; } setFinderReadOnly(false); - _scintView.addGenericText(str.c_str()); + _scintView.addGenericText(str.c_str(), &mi._start, &mi._end); setFinderReadOnly(true); + _pMainMarkings->push_back(mi); }; void setFinderStyle(); @@ -311,12 +313,13 @@ public : bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL); bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL); - int markAll(const TCHAR *str2find); + int markAll(const TCHAR *txt2find, int styleID); int markAll2(const TCHAR *str2find); int markAllInc(const TCHAR *str2find, FindOption *opt); + - int processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire = false, const TCHAR *fileName = NULL, FindOption *opt = NULL); - int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, FindOption *opt = NULL); + int processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire = false, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1); + int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1); void replaceAllInOpenedDocs(); void findAllIn(InWhat op); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 3c64bfe6..3eac2553 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -187,20 +187,33 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_INC, INDIC_ROUNDBOX); execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_TAGMATCH, INDIC_ROUNDBOX); execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_TAGATTR, INDIC_ROUNDBOX); - + execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT1, INDIC_ROUNDBOX); + execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT2, INDIC_ROUNDBOX); + execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT3, INDIC_ROUNDBOX); + execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT4, INDIC_ROUNDBOX); + execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT5, INDIC_ROUNDBOX); execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_2, 100); execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE, 100); execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_INC, 100); execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_TAGMATCH, 100); execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_TAGATTR, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT1, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT2, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT3, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT4, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT5, 100); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_2, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_INC, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGMATCH, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGATTR, true); - + execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT1, true); + execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT2, true); + execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT3, true); + execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true); + execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true); _pParameter = NppParameters::getInstance(); _codepage = ::GetACP(); @@ -978,16 +991,58 @@ void ScintillaEditView::defineDocType(LangType typeDoc) pStyle = &(stylers.getStyler(iFind)); } setSpecialIndicator(*pStyle); -/* - iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_SELECT_STYLE); + + + defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1; + defaultIndicatorStyle._bgColor = cyan; + pStyle = &defaultIndicatorStyle; + iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT1); if (iFind != -1) { - Style & styleFind = stylers.getStyler(iFind); - setSpecialStyle(styleFind); + pStyle = &(stylers.getStyler(iFind)); } -*/ + setSpecialIndicator(*pStyle); + + defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2; + defaultIndicatorStyle._bgColor = orange; + pStyle = &defaultIndicatorStyle; + iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT2); + if (iFind != -1) + { + pStyle = &(stylers.getStyler(iFind)); + } + setSpecialIndicator(*pStyle); + + defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3; + defaultIndicatorStyle._bgColor = yellow; + pStyle = &defaultIndicatorStyle; + iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT3); + if (iFind != -1) + { + pStyle = &(stylers.getStyler(iFind)); + } + setSpecialIndicator(*pStyle); + + defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4; + defaultIndicatorStyle._bgColor = purple; + pStyle = &defaultIndicatorStyle; + iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT4); + if (iFind != -1) + { + pStyle = &(stylers.getStyler(iFind)); + } + setSpecialIndicator(*pStyle); + + defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5; + defaultIndicatorStyle._bgColor = darkGreen; + pStyle = &defaultIndicatorStyle; + iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT5); + if (iFind != -1) + { + pStyle = &(stylers.getStyler(iFind)); + } + setSpecialIndicator(*pStyle); int caretWidth = 1; - // Il faut surtout faire un test ici avant d'exécuter SCI_SETCODEPAGE // Sinon y'aura un soucis de performance! @@ -1597,6 +1652,18 @@ void ScintillaEditView::addGenericText(const TCHAR * text2Append) const #endif } +void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const +{ +#ifdef UNICODE + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + unsigned int cp = execute(SCI_GETCODEPAGE); + const char *text2AppendA =wmc->wchar2char(text2Append, cp, mstart, mend); + execute(SCI_ADDTEXT, strlen(text2AppendA), (LPARAM)text2AppendA); +#else + execute(SCI_ADDTEXT, strlen(text2Append), (LPARAM)text2Append); +#endif +} + int ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTargetPos, int toTargetPos) const { if (fromTargetPos != -1 || toTargetPos != -1) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index a51ef7bb..0f72cfcc 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -193,6 +193,7 @@ public: int searchInTarget(const TCHAR * Text2Find, int fromPos, int toPos) const; void appandGenericText(const TCHAR * text2Append) const; void addGenericText(const TCHAR * text2Append) const; + void addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const; int replaceTarget(const TCHAR * str2replace, int fromTargetPos = -1, int toTargetPos = -1) const; int replaceTargetRegExMode(const TCHAR * re, int fromTargetPos = -1, int toTargetPos = -1) const; void showAutoComletion(int lenEntered, const TCHAR * list); diff --git a/PowerEditor/src/contextMenu.xml b/PowerEditor/src/contextMenu.xml index 4b6ac8f0..067f535c 100644 --- a/PowerEditor/src/contextMenu.xml +++ b/PowerEditor/src/contextMenu.xml @@ -6,8 +6,18 @@ - - + + + + + + + + + + + + diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index bb04826d..04bd8695 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -109,7 +109,18 @@ #define IDM_SEARCH_COPYMARKEDLINES (IDM_SEARCH + 19) #define IDM_SEARCH_PASTEMARKEDLINES (IDM_SEARCH + 20) #define IDM_SEARCH_DELETEMARKEDLINES (IDM_SEARCH + 21) - + #define IDM_SEARCH_MARKALLEXT1 (IDM_SEARCH + 22) + #define IDM_SEARCH_UNMARKALLEXT1 (IDM_SEARCH + 23) + #define IDM_SEARCH_MARKALLEXT2 (IDM_SEARCH + 24) + #define IDM_SEARCH_UNMARKALLEXT2 (IDM_SEARCH + 25) + #define IDM_SEARCH_MARKALLEXT3 (IDM_SEARCH + 26) + #define IDM_SEARCH_UNMARKALLEXT3 (IDM_SEARCH + 27) + #define IDM_SEARCH_MARKALLEXT4 (IDM_SEARCH + 28) + #define IDM_SEARCH_UNMARKALLEXT4 (IDM_SEARCH + 29) + #define IDM_SEARCH_MARKALLEXT5 (IDM_SEARCH + 30) + #define IDM_SEARCH_UNMARKALLEXT5 (IDM_SEARCH + 31) + #define IDM_SEARCH_CLEARALLMARKS (IDM_SEARCH + 32) + #define IDM_VIEW (IDM + 4000) //#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1) #define IDM_VIEW_TOOLBAR_REDUCE (IDM_VIEW + 2) diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml index 7723d671..dbab0423 100644 --- a/PowerEditor/src/stylers.model.xml +++ b/PowerEditor/src/stylers.model.xml @@ -714,6 +714,11 @@ + + + + + diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index a11de833..f31531c4 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -113,6 +113,11 @@ #define SCE_UNIVERSAL_FOUND_STYLE_INC 28 #define SCE_UNIVERSAL_TAGMATCH 27 #define SCE_UNIVERSAL_TAGATTR 26 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 diff --git a/scintilla/src/LexSearchResult.cxx b/scintilla/src/LexSearchResult.cxx index 9f917082..7244c158 100644 --- a/scintilla/src/LexSearchResult.cxx +++ b/scintilla/src/LexSearchResult.cxx @@ -77,8 +77,8 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin SearchResultMarking mi = pMarkings->_markings[linenum]; currentPos += 2; // skip ": " - unsigned int match_start = startLine + currentPos + mi._start - 1; - unsigned int match_end = startLine + currentPos + mi._end - 1; + unsigned int match_start = startLine + mi._start - 1; + unsigned int match_end = startLine + mi._end - 1; if (match_start <= endPos) { styler.ColourTo(match_start, SCE_SEARCHRESULT_DEFAULT);