From 04f43d85631418398e4d01d9a4d189c284608ed3 Mon Sep 17 00:00:00 2001 From: donho Date: Sun, 3 Aug 2008 01:14:41 +0000 Subject: [PATCH] [RELEASE] Notepad++ v5.0.3. Fix the display problem in found results dialog while processing find in all opened files/find in files in a file contains a very long line. Fix not remembering the history file setting "Don't check at launch time" option bug. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@303 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/bin/change.log | 8 ++++ PowerEditor/installer/nppSetup.nsi | 6 +-- PowerEditor/src/ScitillaComponent/Buffer.cpp | 13 ++---- PowerEditor/src/ScitillaComponent/Buffer.h | 9 +--- .../src/ScitillaComponent/FindReplaceDlg.cpp | 6 +-- .../src/ScitillaComponent/FindReplaceDlg.h | 7 ++++ .../ScitillaComponent/ScintillaEditView.cpp | 41 +++++++++++-------- .../WinControls/Preference/preferenceDlg.cpp | 4 +- PowerEditor/src/resource.h | 6 +-- scintilla/include/Scintilla.h | 1 + scintilla/src/LexSearchResult.cxx | 8 +--- 11 files changed, 57 insertions(+), 52 deletions(-) diff --git a/PowerEditor/bin/change.log b/PowerEditor/bin/change.log index ad0cd1c42..9cf3f03a5 100644 --- a/PowerEditor/bin/change.log +++ b/PowerEditor/bin/change.log @@ -1,3 +1,11 @@ +Notepad++ v5.0.3 fixed bugs and added features (from v5.0.2) : + +1. Fix crash bug while processing find in all opened files/find in files in a file contains a very long line. +2. Fix the display problem in found results dialog while processing find in all opened files/find in files in a file contains a very long line. +3. Fix not remembering the history file setting "Don't check at launch time" option bug. + + + Notepad++ v5.0.2 fixed bugs and added features (from v5.0.1) : 1. Fix crash bug for tags match highlighting. diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index e7f982946..ebfedba11 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -17,16 +17,16 @@ ; Define the application name !define APPNAME "Notepad++" -!define APPNAMEANDVERSION "Notepad++ v5.0.2" +!define APPNAMEANDVERSION "Notepad++ v5.0.3" !define VERSION_MAJOR 5 -!define VERSION_MINOR 02 +!define VERSION_MINOR 03 ; Main Install settings Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\Notepad++" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "..\bin\npp.5.0.2.Installer.exe" +OutFile "..\bin\npp.5.0.3.Installer.exe" ; GetWindowsVersion ; diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 0aebb7499..a62602e69 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -324,10 +324,7 @@ void Buffer::setDeferredReload() { //triggers a reload on the next Document acce } //filemanager -FileManager::FileManager() : - _nextNewNumber(1), _nextBufferID(0), _pNotepadPlus(NULL), _nrBufs(0), _pscratchTilla(NULL) -{ -} + void FileManager::init(Notepad_plus * pNotepadPlus, ScintillaEditView * pscratchTilla) { @@ -338,10 +335,7 @@ void FileManager::init(Notepad_plus * pNotepadPlus, ScintillaEditView * pscratch _pscratchTilla->execute(SCI_ADDREFDOCUMENT, 0, _scratchDocDefault); } -FileManager::~FileManager() { - //Release automatic with Scintilla destructor - //_pscratchTilla->execute(SCI_RELEASEDOCUMENT, 0, _scratchDocDefault); -} + void FileManager::checkFilesystemChanges() { for(size_t i = 0; i < _nrBufs; i++) { @@ -377,8 +371,7 @@ void FileManager::closeBuffer(BufferID id, ScintillaEditView * identifier) { int oldRefs = buf->_references; int refs = buf->removeReference(identifier); - //if (oldRefs != refs) - // _pscratchTilla->execute(SCI_RELEASEDOCUMENT, 0, buf->_doc); //we can release the document for the reference of container (it has changed so it was a valid operation) + if (!refs) { //buffer can be deallocated _pscratchTilla->execute(SCI_RELEASEDOCUMENT, 0, buf->_doc); //release for FileManager, Document is now gone _buffers.erase(_buffers.begin() + index); diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index 8d4fbc74f..3dd3104c0 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -101,8 +101,8 @@ public: int getFileNameFromBuffer(BufferID id, char * fn2copy); private: - FileManager(); - ~FileManager(); + FileManager() : _nextNewNumber(1), _nextBufferID(0), _pNotepadPlus(NULL), _nrBufs(0), _pscratchTilla(NULL){}; + ~FileManager(){}; static FileManager *_pSelf; Notepad_plus * _pNotepadPlus; @@ -240,11 +240,6 @@ public : }; void setUnicodeMode(UniMode mode) { - /*if ((_unicodeMode != mode) && - !((_unicodeMode == uni8Bit) && (mode == uniCookie)) && \ - !((_unicodeMode == uniCookie) && (mode == uni8Bit))) { - //this check excludes switch between Utf8-w/o bom and ANSI. However, that makes a change too - }*/ _unicodeMode = mode; //_isDirty = true; //set to dirty if change unicode mode doNotify(BufferChangeUnicode | BufferChangeDirty); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 7156bcfb8..7525dc2b2 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -1155,9 +1155,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, const char *txt2find, cons case ProcessFindAll: { int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart); - //int lend = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber); - //int lstart = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber); - int nbChar = (*_ppEditView)->execute(SCI_LINELENGTH, lineNumber); + int lend = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber); + int lstart = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber); + int nbChar = lend - lstart; bool isRealloc = false; if (_maxNbCharAllocated < nbChar) //line longer than buffer, resize buffer diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index f93bf5d54..ca7f9291b 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -119,6 +119,13 @@ public: str += itoa(lineNb, lnb, 10); str += " : "; str += fi._foundLine; + + if (str.length() >= SC_SEARCHRESULT_LINEBUFFERMAXLENGTH) + { + const char * endOfLongLine = "...\r\n"; + str = str.substr(0, SC_SEARCHRESULT_LINEBUFFERMAXLENGTH - strlen(endOfLongLine) - 1); + str += endOfLongLine; + } setFinderReadOnly(false); _scintView.execute(SCI_APPENDTEXT, str.length(), (LPARAM)str.c_str()); setFinderReadOnly(true); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 480cb9ee6..b5e717ccb 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1033,11 +1033,11 @@ void ScintillaEditView::restoreCurrentPos() } void ScintillaEditView::restyleBuffer() { - int end = execute(SCI_GETENDSTYLED); //style up to the last styled byte. - if (end == 0) - return; + //int end = execute(SCI_GETENDSTYLED); //style up to the last styled byte. + //if (end == 0) + // return; execute(SCI_CLEARDOCUMENTSTYLE); - execute(SCI_COLOURISE, 0, end); + execute(SCI_COLOURISE, 0, -1); _currentBuffer->setNeedsLexing(false); } @@ -1122,34 +1122,41 @@ void ScintillaEditView::activateBuffer(BufferID buffer) } void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) { //actually only care about language and lexing etc - if (buffer == _currentBuffer) { - if (mask & BufferChangeLanguage) { + if (buffer == _currentBuffer) + { + if (mask & BufferChangeLanguage) + { defineDocType(buffer->getLangType()); foldAll(fold_uncollapse); } - if (mask & BufferChangeLexing) { - if (buffer->getNeedsLexing()) { + if (mask & BufferChangeLexing) + { + if (buffer->getNeedsLexing()) + { restyleBuffer(); //sets to false, this will apply to any other view aswell } //else nothing, otherwise infinite loop } - if (mask & BufferChangeFormat) { + if (mask & BufferChangeFormat) + { execute(SCI_SETEOLMODE, _currentBuffer->getFormat()); } - if (mask & BufferChangeReadonly) { + if (mask & BufferChangeReadonly) + { execute(SCI_SETREADONLY, _currentBuffer->isReadOnly()); } - if (mask & BufferChangeUnicode) { - if (_currentBuffer->getUnicodeMode() == uni8Bit) { //either 0 or CJK codepage - if (isCJK()) { + if (mask & BufferChangeUnicode) + { + if (_currentBuffer->getUnicodeMode() == uni8Bit) + { //either 0 or CJK codepage + if (isCJK()) execute(SCI_SETCODEPAGE, _codepage); //you may also want to set charsets here, not yet implemented - } else { + else execute(SCI_SETCODEPAGE, 0); - } - } else { //CP UTF8 for all unicode + } + else //CP UTF8 for all unicode execute(SCI_SETCODEPAGE, SC_CP_UTF8); - } } } } diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index c3a9e3f2a..7e3104773 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -601,8 +601,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara switch (wParam) { case IDC_CHECK_DONTCHECKHISTORY: - nppGUI._checkHistoryFiles = isCheckedOrNot(IDC_CHECK_DONTCHECKHISTORY); - //::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_HISTORY_DONT_CHECK, 0); + nppGUI._checkHistoryFiles = !isCheckedOrNot(IDC_CHECK_DONTCHECKHISTORY); return TRUE; case IDC_CHECK_FILEAUTODETECTION: @@ -617,7 +616,6 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_UPDATEGOTOEOF), isChecked); nppGUI._fileAutoDetection = isChecked?cdAutoUpdate:cdDisabled; - //::SendMessage(_hParent, WM_COMMAND, isChecked?IDM_SETTING_FILE_AUTODETECTION_ENABLE:IDM_SETTING_FILE_AUTODETECTION_DISABLE, 0); } return TRUE; diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 10b529f03..0e3b6ee8a 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -18,9 +18,9 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define NOTEPAD_PLUS_VERSION "Notepad++ v5.0.2" -#define VERSION_VALUE "5.02\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 -#define VERSION_DIGITALVALUE 5, 0, 2, 0 +#define NOTEPAD_PLUS_VERSION "Notepad++ v5.0.3" +#define VERSION_VALUE "5.03\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 +#define VERSION_DIGITALVALUE 5, 0, 3, 0 #ifndef IDC_STATIC #define IDC_STATIC -1 diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index e0786cdd3..ef889410b 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -703,6 +703,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MOD_CHANGEINDICATOR 0x4000 #define SC_MOD_CHANGELINESTATE 0x8000 #define SC_MODEVENTMASKALL 0xFFFF +#define SC_SEARCHRESULT_LINEBUFFERMAXLENGTH 1024 #define SCEN_CHANGE 768 #define SCEN_SETFOCUS 512 #define SCEN_KILLFOCUS 256 diff --git a/scintilla/src/LexSearchResult.cxx b/scintilla/src/LexSearchResult.cxx index 6acb295c0..c3b16b067 100644 --- a/scintilla/src/LexSearchResult.cxx +++ b/scintilla/src/LexSearchResult.cxx @@ -42,10 +42,6 @@ static const char * const emptyWordListDesc[] = { 0 }; -static inline bool isAWordChar(const int ch) { - return ((ch > 0x20) && (ch <= 0xFF) && (ch != ' ') && (ch != '\n')); -} - inline bool isSpaceChar(char ch) { return ((ch == ' ') || (ch == ' ')); }; @@ -160,7 +156,7 @@ end : } static void ColouriseSearchResultDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler) { - char lineBuffer[1024]; + char lineBuffer[SC_SEARCHRESULT_LINEBUFFERMAXLENGTH]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; @@ -201,7 +197,7 @@ static void FoldSearchResultDoc(unsigned int startPos, int length, int, WordList int style = styleNext; styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + bool atEOL = (ch == '\n') || (ch == '\r' && chNext != '\n'); if (style == SCE_SEARCHRESULT_HEARDER) {