[BUG_FIXED] Fix "Select and Find Next" and "Count" regressions.

[UPDATE] Adapt Scintilla 2.20 (making SCI_SETPROPERTIES call after SCI_SETLEXER call).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@661 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-09-04 17:22:03 +00:00
parent a1866aba6d
commit 247375f6cf
5 changed files with 25 additions and 3 deletions

View File

@ -290,6 +290,7 @@ void Notepad_plus::command(int id)
TCHAR str[strSize]; TCHAR str[strSize];
_pEditView->getGenericSelectedText(str, strSize); _pEditView->getGenericSelectedText(str, strSize);
_findReplaceDlg.setSearchText(str); _findReplaceDlg.setSearchText(str);
_findReplaceDlg._env->_str2Search = str;
setFindReplaceFolderFilter(NULL, NULL); setFindReplaceFolderFilter(NULL, NULL);
if (isFirstTime) if (isFirstTime)
_nativeLangSpeaker.changeFindReplaceDlgLang(_findReplaceDlg); _nativeLangSpeaker.changeFindReplaceDlgLang(_findReplaceDlg);

View File

@ -937,6 +937,11 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{ {
if (_currentStatus == FIND_DLG) if (_currentStatus == FIND_DLG)
{ {
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
updateCombo(IDFINDWHAT);
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
int nbCounted = processAll(ProcessCountAll, &_options); int nbCounted = processAll(ProcessCountAll, &_options);
generic_string result = TEXT(""); generic_string result = TEXT("");
@ -2303,6 +2308,7 @@ void Finder::finishFilesSearch(int count)
_scintView.execute(SCI_SETSEL, 0, 0); _scintView.execute(SCI_SETSEL, 0, 0);
_scintView.execute(SCI_SETLEXER, SCLEX_SEARCHRESULT); _scintView.execute(SCI_SETLEXER, SCLEX_SEARCHRESULT);
_scintView.execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
} }

View File

@ -761,7 +761,8 @@ void ScintillaEditView::setCppLexer(LangType langType)
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1"));
// "#if 1 //" make CppLexer crash, so we disable it. // Disable track preprocessor to avoid incorrect detection.
// In the most of cases, the symbols are defined outside of file.
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("lexer.cpp.track.preprocessor"), reinterpret_cast<LPARAM>("0")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("lexer.cpp.track.preprocessor"), reinterpret_cast<LPARAM>("0"));
} }
@ -872,6 +873,12 @@ void ScintillaEditView::setObjCLexer(LangType langType)
execute(SCI_SETKEYWORDS, 2, (LPARAM)doxygenKeyWords); execute(SCI_SETKEYWORDS, 2, (LPARAM)doxygenKeyWords);
execute(SCI_SETKEYWORDS, 3, (LPARAM)objCDirective); execute(SCI_SETKEYWORDS, 3, (LPARAM)objCDirective);
execute(SCI_SETKEYWORDS, 4, (LPARAM)objCQualifier); execute(SCI_SETKEYWORDS, 4, (LPARAM)objCQualifier);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1"));
} }
void ScintillaEditView::setKeywords(LangType langType, const char *keywords, int index) void ScintillaEditView::setKeywords(LangType langType, const char *keywords, int index)
@ -966,7 +973,6 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList)
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1"));
} }
void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray) void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray)

View File

@ -695,6 +695,8 @@ protected:
execute(SCI_SETLEXER, SCLEX_PROPERTIES); execute(SCI_SETLEXER, SCLEX_PROPERTIES);
execute(SCI_STYLESETEOLFILLED, SCE_PROPS_SECTION, true); execute(SCI_STYLESETEOLFILLED, SCE_PROPS_SECTION, true);
makeStyle(L_INI); makeStyle(L_INI);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0"));
}; };
@ -713,6 +715,7 @@ protected:
void setPascalLexer() { void setPascalLexer() {
setLexer(SCLEX_PASCAL, L_PASCAL, LIST_0); setLexer(SCLEX_PASCAL, L_PASCAL, LIST_0);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1"));
}; };
void setPerlLexer() { void setPerlLexer() {
@ -784,6 +787,7 @@ protected:
void setAutoItLexer(){ void setAutoItLexer(){
setLexer(SCLEX_AU3, L_AU3, LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6); setLexer(SCLEX_AU3, L_AU3, LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1"));
}; };
void setCamlLexer(){ void setCamlLexer(){
@ -796,6 +800,7 @@ protected:
void setVerilogLexer(){ void setVerilogLexer(){
setLexer(SCLEX_VERILOG, L_VERILOG, LIST_0 | LIST_1); setLexer(SCLEX_VERILOG, L_VERILOG, LIST_0 | LIST_1);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.preprocessor"), reinterpret_cast<LPARAM>("1"));
}; };
void setMatlabLexer(){ void setMatlabLexer(){

View File

@ -563,6 +563,10 @@ recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam)
case IDD_FINDINFILES_DIR_COMBO: case IDD_FINDINFILES_DIR_COMBO:
case IDD_FINDINFILES_FILTERS_COMBO: case IDD_FINDINFILES_FILTERS_COMBO:
sParameter = *reinterpret_cast<TCHAR *>(lParameter); sParameter = *reinterpret_cast<TCHAR *>(lParameter);
//::MessageBoxA(NULL, (LPCSTR)(*reinterpret_cast<char *>(lParameter)), "A", MB_OK);
//::MessageBoxW(NULL, (LPCWSTR)(*reinterpret_cast<WCHAR *>(lParameter)), TEXT("W"), MB_OK);
//printStr(sParameter.c_str());
MacroType = mtUseSParameter; MacroType = mtUseSParameter;
lParameter = 0; lParameter = 0;
break; break;
@ -582,7 +586,7 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView)
{ {
long lParam = lParameter; long lParam = lParameter;
if (MacroType == mtUseSParameter) if (MacroType == mtUseSParameter)
lParam = reinterpret_cast<long>(sParameter.c_str()); lParam = reinterpret_cast<LPARAM>(sParameter.c_str());
pEditView->execute(message, wParameter, lParam); pEditView->execute(message, wParameter, lParam);
if ( (message == SCI_SETTEXT) if ( (message == SCI_SETTEXT)
|| (message == SCI_REPLACESEL) || (message == SCI_REPLACESEL)