[BUG_FIXED] Fix "find in all opened files" and "find in files" unicode text search bug in ANSI version.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@343 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-10-19 14:52:08 +00:00
parent c16b93830a
commit f033f1a8e7
5 changed files with 41 additions and 28 deletions

View File

@ -17,16 +17,16 @@
; Define the application name
!define APPNAME "Notepad++"
!define APPNAMEANDVERSION "Notepad++ v5.0.3"
!define APPNAMEANDVERSION "Notepad++ v5.1"
!define VERSION_MAJOR 5
!define VERSION_MINOR 03
!define VERSION_MINOR 1
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Notepad++"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "..\bin\npp.5.0.3.Installer.exe"
OutFile "..\bin\npp.5.1.Installer.exe"
; GetWindowsVersion
;
@ -202,6 +202,8 @@ FunctionEnd
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Galician"
;!insertmacro MUI_LANGUAGE "Latvian"
;!insertmacro MUI_LANGUAGE "Macedonian"
@ -210,12 +212,10 @@ FunctionEnd
;!insertmacro MUI_LANGUAGE "Luxembourgish"
;!insertmacro MUI_LANGUAGE "Breton"
;!insertmacro MUI_LANGUAGE "Icelandic"
;!insertmacro MUI_LANGUAGE "Malay"
;!insertmacro MUI_LANGUAGE "Bosnian"
;!insertmacro MUI_LANGUAGE "Kurdish"
;!insertmacro MUI_LANGUAGE "Irish"
;!insertmacro MUI_LANGUAGE "Uzbek"
;!insertmacro MUI_LANGUAGE "Galician"
;!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_RESERVEFILE_LANGDLL
@ -278,6 +278,8 @@ LangString langFileName ${LANG_THAI} "thai.xml"
LangString langFileName ${LANG_NORWEGIANNYNORSK} "nynorsk.xml"
LangString langFileName ${LANG_BELARUSIAN} "belarusian.xml"
LangString langFileName ${LANG_ALBANIAN} "albanian.xml"
LangString langFileName ${LANG_MALAY} "malay.xml"
LangString langFileName ${LANG_GALICIAN} "galician.xml"
;--------------------------------
;Variables
@ -937,12 +939,13 @@ SubSection un.Plugins
Delete "$INSTDIR\Explorer.ini"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
Section un.FileBrowserLite
Delete "$INSTDIR\plugins\LightExplorer.dll"
Delete "$INSTDIR\lightExplorer.ini"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
/*
Section un.HexEditor
Delete "$INSTDIR\plugins\HexEditor.dll"
@ -962,7 +965,7 @@ SubSection un.Plugins
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
/*
Section un.SpellChecker
Delete "$INSTDIR\plugins\SpellChecker.dll"
RMDir "$INSTDIR\plugins\"
@ -976,21 +979,22 @@ SubSection un.Plugins
RMDir "$INSTDIR\plugins\"
RMDir "$INSTDIR\plugins\doc\"
SectionEnd
/*
Section un.QuickText
Delete "$INSTDIR\plugins\QuickText.dll"
Delete "$INSTDIR\QuickText.ini"
Delete "$INSTDIR\plugins\doc\quickText_README.txt"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
Section un.NppTools
*/
Section un.MIMETools
Delete "$INSTDIR\plugins\NppTools.dll"
Delete "$INSTDIR\plugins\mimeTools.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
Section un.FTP_synchronize
Delete "$INSTDIR\plugins\FTP_synchronizeA.dll"
Delete "$INSTDIR\plugins\FTP_synchronize.dll"
Delete "$INSTDIR\plugins\doc\FTP_synchonize.ReadMe.txt"
RMDir "$INSTDIR\plugins\"
SectionEnd
@ -999,12 +1003,12 @@ SubSection un.Plugins
Delete "$INSTDIR\plugins\NppExport.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
/*
Section un.ComparePlugin
Delete "$INSTDIR\plugins\ComparePlugin.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
Section un.DocMonitor
Delete "$INSTDIR\plugins\docMonitor.dll"
RMDir "$INSTDIR\plugins\"

View File

@ -1621,7 +1621,8 @@ DWORD WINAPI AsyncFindInFiles(LPVOID iValue)
return 0;
}
bool Notepad_plus::findInOpenedFiles() {
bool Notepad_plus::findInOpenedFiles()
{
int nbTotal = 0;
ScintillaEditView *pOldView = _pEditView;
_pEditView = &_invisibleEditView;

View File

@ -1109,7 +1109,8 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
fileName = TEXT("");
FindOption *pOptions = opt?opt:&_options;
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
//bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
bool isUnicode = ((*_ppEditView)->execute(SCI_GETCODEPAGE) == SC_CP_UTF8);
int stringSizeFind = 0;
int stringSizeReplace = 0;
@ -1234,9 +1235,24 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
lend = lstart + 1020;
(*_ppEditView)->getGenericText(lineBuf, lstart, lend);
generic_string line = lineBuf;
generic_string line;
#ifdef UNICODE
line = lineBuf;
//_pFinder->add(FoundInfo(targetStart, targetEnd, line.c_str(), fileName, _pFinder->_lineCounter), lineNumber + 1);
#else
UINT cp = (*_ppEditView)->execute(SCI_GETCODEPAGE);
if (cp != SC_CP_UTF8)
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t *pTextW = wmc->char2wchar(lineBuf, ::GetACP());
const char *pTextA = wmc->wchar2char(pTextW, SC_CP_UTF8);
line = pTextA;
}
else
line = lineBuf;
#endif
line += TEXT("\r\n");
_pFinder->add(FoundInfo(targetStart, targetEnd, line.c_str(), fileName, _pFinder->_lineCounter), lineNumber + 1);
break;

View File

@ -1427,9 +1427,8 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, int fromPos, int
{
execute(SCI_SETTARGETSTART, fromPos);
execute(SCI_SETTARGETEND, toPos);
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
unsigned int cp = execute(SCI_GETCODEPAGE);
const char *text2FindA = wmc->wchar2char(text2Find, cp);
int targetFound = execute(SCI_SEARCHINTARGET, (WPARAM)strlen(text2FindA), (LPARAM)text2FindA);
@ -1439,13 +1438,6 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, int fromPos, int
#endif
}
/*
void ScintillaEditView::appandText(const char * text2Append) const
{
execute(SCI_APPENDTEXT, strlen(text2Append), (LPARAM)text2Append);
}
*/
void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const
{
#ifdef UNICODE

View File

@ -21,7 +21,7 @@
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops;.\no_ms_shit.vsprops"
CharacterSet="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"