From 8c27c2a20d77379d59a98a7b2cbba6a4e86e4a45 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 2 Apr 2012 01:39:09 +0000 Subject: [PATCH] [BUG_FIXED] 1. User Defined Language syntax highlighting problem while Doc Map is opened. 2. Chinese characters showing problem while Doc Map is opened. 3. the old behaviour (comment/uncomment w/o selection) is restored. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@888 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/installer/nativeLang/french.xml | 8 ++-- PowerEditor/src/Notepad_plus.cpp | 41 ++++++++++-------- .../src/ScitillaComponent/ScintillaEditView.h | 9 ++-- .../WinControls/DocumentMap/documentMap.cpp | 13 ++++-- PowerEditor/src/localizationString.h | Bin 7644 -> 7726 bytes 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index ac32fd52..97a20413 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -29,10 +29,10 @@ - - - - + + + + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3819f878..3ee9be7c 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -967,7 +967,7 @@ bool Notepad_plus::replaceAllFiles() { _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); - _invisibleEditView._currentBuffer = pBuf; + _invisibleEditView.setCurrentBuffer(pBuf); _invisibleEditView.execute(SCI_BEGINUNDOACTION); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc); _invisibleEditView.execute(SCI_ENDUNDOACTION); @@ -984,7 +984,7 @@ bool Notepad_plus::replaceAllFiles() { _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); - _invisibleEditView._currentBuffer = pBuf; + _invisibleEditView.setCurrentBuffer(pBuf); _invisibleEditView.execute(SCI_BEGINUNDOACTION); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc); _invisibleEditView.execute(SCI_ENDUNDOACTION); @@ -992,7 +992,7 @@ bool Notepad_plus::replaceAllFiles() { } _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); - _invisibleEditView._currentBuffer = oldBuf; + _invisibleEditView.setCurrentBuffer(oldBuf); _pEditView = pOldView; @@ -1210,7 +1210,7 @@ bool Notepad_plus::replaceInFiles() _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); - _invisibleEditView._currentBuffer = pBuf; + _invisibleEditView.setCurrentBuffer(pBuf); int nbReplaced = _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, true, fileNames.at(i).c_str()); nbTotal += nbReplaced; @@ -1228,7 +1228,7 @@ bool Notepad_plus::replaceInFiles() TerminateThread(CancelThreadHandle, 0); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); - _invisibleEditView._currentBuffer = oldBuf; + _invisibleEditView.setCurrentBuffer(oldBuf); _pEditView = pOldView; TCHAR msg[128]; @@ -1472,17 +1472,10 @@ void Notepad_plus::checkClipboard() bool canPaste = (_pEditView->execute(SCI_CANPASTE) != 0); enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR); - enableCommand(IDM_EDIT_PASTE, canPaste, MENU | TOOLBAR); - //enableCommand(IDM_EDIT_PASTE, true, MENU | TOOLBAR); - enableCommand(IDM_EDIT_DELETE, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_UPPERCASE, hasSelection, MENU); enableCommand(IDM_EDIT_LOWERCASE, hasSelection, MENU); - enableCommand(IDM_EDIT_BLOCK_COMMENT, hasSelection, MENU); - enableCommand(IDM_EDIT_BLOCK_COMMENT_SET, hasSelection, MENU); - enableCommand(IDM_EDIT_BLOCK_UNCOMMENT, hasSelection, MENU); - enableCommand(IDM_EDIT_STREAM_COMMENT, hasSelection, MENU); } void Notepad_plus::checkDocState() @@ -2723,7 +2716,8 @@ void Notepad_plus::loadBufferIntoView(BufferID id, int whichOne, bool dontClose) } } -bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) { +bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) +{ DocTabView * tabToClose = (whichOne == MAIN_VIEW)?&_mainDocTab:&_subDocTab; ScintillaEditView * viewToClose = (whichOne == MAIN_VIEW)?&_mainEditView:&_subEditView; @@ -2744,24 +2738,33 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) { } int active = tabToClose->getCurrentTabIndex(); - if (active == index) { //need an alternative (close real doc, put empty one back - if (tabToClose->nbItem() == 1) { //need alternative doc, add new one. Use special logic to prevent flicker of adding new tab then closing other + if (active == index) //need an alternative (close real doc, put empty one back) + { + if (tabToClose->nbItem() == 1) //need alternative doc, add new one. Use special logic to prevent flicker of adding new tab then closing other + { BufferID newID = MainFileManager->newEmptyDocument(); MainFileManager->addBufferReference(newID, viewToClose); tabToClose->setBuffer(0, newID); //can safely use id 0, last (only) tab open activateBuffer(newID, whichOne); //activate. DocTab already activated but not a problem - } else { + } + else + { int toActivate = 0; //activate next doc, otherwise prev if not possible - if (active == tabToClose->nbItem() - 1) { //prev + if (active == tabToClose->nbItem() - 1) //prev + { toActivate = active - 1; - } else { + } + else + { toActivate = active; //activate the 'active' index. Since we remove the tab first, the indices shift (on the right side) } tabToClose->deletItemAt((size_t)index); //delete first activateBuffer(tabToClose->getBufferByIndex(toActivate), whichOne); //then activate. The prevent jumpy tab behaviour } - } else { + } + else + { tabToClose->deletItemAt((size_t)index); } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 60a23899..30a90d7b 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -188,7 +188,7 @@ struct LanguageName { class ScintillaEditView : public Window { - friend class Notepad_plus; + //friend class Notepad_plus; friend class Finder; public: ScintillaEditView() @@ -563,6 +563,7 @@ public: void bufferUpdated(Buffer * buffer, int mask); BufferID getCurrentBufferID() { return _currentBufferID; }; Buffer * getCurrentBuffer() { return _currentBuffer; }; + void setCurrentBuffer(Buffer *buf2set) { _currentBuffer = buf2set; }; void styleChange(); void hideLines(); @@ -595,7 +596,9 @@ public: void mouseWheel(WPARAM wParam, LPARAM lParam) { scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam); }; - + + void setHotspotStyle(Style& styleToSet); + void setTabSettings(Lang *lang); /* pair getLineUndoState(size_t currentLine) { Buffer * buf = getCurrentBuffer(); @@ -674,7 +677,6 @@ protected: void setKeywords(LangType langType, const char *keywords, int index); void setLexer(int lexerID, LangType langType, int whichList); inline void makeStyle(LangType langType, const TCHAR **keywordArray = NULL); - void setHotspotStyle(Style& styleToSet); void setStyle(Style styleToSet); //NOT by reference (style edited) void setSpecialStyle(const Style & styleToSet); //by reference void setSpecialIndicator(const Style & styleToSet) { @@ -907,7 +909,6 @@ protected: } }; - void setTabSettings(Lang *lang); pair getWordRange(); bool expandWordSelection(); }; diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index 35928295..b1160255 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -29,9 +29,15 @@ void DocumentMap::reloadMap() Document currentDoc = (*_ppEditView)->execute(SCI_GETDOCPOINTER); ::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETDOCPOINTER, 0, (LPARAM)currentDoc); + // // sync with the current document - // Lexing - _pScintillaEditView->defineDocType((*_ppEditView)->getCurrentBuffer()->getLangType()); + // + + Buffer *editBuf = (*_ppEditView)->getCurrentBuffer(); + _pScintillaEditView->setCurrentBuffer(editBuf); + + // lexer + _pScintillaEditView->defineDocType(editBuf->getLangType()); _pScintillaEditView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); // folding @@ -43,9 +49,10 @@ void DocumentMap::reloadMap() //initWrapMap(); wrapMap(); } + scrollMap(); - } + } bool DocumentMap::needToRecomputeWith() diff --git a/PowerEditor/src/localizationString.h b/PowerEditor/src/localizationString.h index 4453ce42c6a7438fa585fcca53fab1b1a2ef00db..fdfc40579aed8db5764e5e00c952b63df991dbfe 100644 GIT binary patch delta 48 zcmca(z0PLC9NEbUTp|K$Y{%KW*sOr0AzK^URkq0=I7GNh87djl88R438Hy(N%K8HU Dc0UeU delta 11 ScmZ2ybH{qa9NEe5WE}t^3I$03