[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
This commit is contained in:
Don Ho 2012-04-02 01:39:09 +00:00
parent f077b71ebf
commit 8c27c2a20d
5 changed files with 41 additions and 30 deletions

View File

@ -29,10 +29,10 @@
<Item posX="1" posY="15" name="Convertir les sauts de ligne"/> <Item posX="1" posY="15" name="Convertir les sauts de ligne"/>
<Item posX="1" posY="16" name="Traitement des espacements"/> <Item posX="1" posY="16" name="Traitement des espacements"/>
<Item posX="1" posY="17" name="Collage special"/> <Item posX="1" posY="17" name="Collage special"/>
<Item posX="2" posY="14" name="Marquer tout"/> <Item posX="2" posY="16" name="Marquer tout"/>
<Item posX="2" posY="15" name="Enlever toutes les marques"/> <Item posX="2" posY="17" name="Enlever toutes les marques"/>
<Item posX="2" posY="16" name="Aller vers le haut"/> <Item posX="2" posY="18" name="Aller vers le haut"/>
<Item posX="2" posY="17" name="Aller vers le bas"/> <Item posX="2" posY="19" name="Aller vers le bas"/>
<Item posX="2" posY="21" name="Signet"/> <Item posX="2" posY="21" name="Signet"/>
<Item posX="3" posY="4" name="Symbole spéciaux"/> <Item posX="3" posY="4" name="Symbole spéciaux"/>
<Item posX="3" posY="5" name="Zoom"/> <Item posX="3" posY="5" name="Zoom"/>

View File

@ -967,7 +967,7 @@ bool Notepad_plus::replaceAllFiles() {
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
_invisibleEditView._currentBuffer = pBuf; _invisibleEditView.setCurrentBuffer(pBuf);
_invisibleEditView.execute(SCI_BEGINUNDOACTION); _invisibleEditView.execute(SCI_BEGINUNDOACTION);
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc);
_invisibleEditView.execute(SCI_ENDUNDOACTION); _invisibleEditView.execute(SCI_ENDUNDOACTION);
@ -984,7 +984,7 @@ bool Notepad_plus::replaceAllFiles() {
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
_invisibleEditView._currentBuffer = pBuf; _invisibleEditView.setCurrentBuffer(pBuf);
_invisibleEditView.execute(SCI_BEGINUNDOACTION); _invisibleEditView.execute(SCI_BEGINUNDOACTION);
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc);
_invisibleEditView.execute(SCI_ENDUNDOACTION); _invisibleEditView.execute(SCI_ENDUNDOACTION);
@ -992,7 +992,7 @@ bool Notepad_plus::replaceAllFiles() {
} }
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc);
_invisibleEditView._currentBuffer = oldBuf; _invisibleEditView.setCurrentBuffer(oldBuf);
_pEditView = pOldView; _pEditView = pOldView;
@ -1210,7 +1210,7 @@ bool Notepad_plus::replaceInFiles()
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); _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()); int nbReplaced = _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, true, fileNames.at(i).c_str());
nbTotal += nbReplaced; nbTotal += nbReplaced;
@ -1228,7 +1228,7 @@ bool Notepad_plus::replaceInFiles()
TerminateThread(CancelThreadHandle, 0); TerminateThread(CancelThreadHandle, 0);
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc);
_invisibleEditView._currentBuffer = oldBuf; _invisibleEditView.setCurrentBuffer(oldBuf);
_pEditView = pOldView; _pEditView = pOldView;
TCHAR msg[128]; TCHAR msg[128];
@ -1472,17 +1472,10 @@ void Notepad_plus::checkClipboard()
bool canPaste = (_pEditView->execute(SCI_CANPASTE) != 0); bool canPaste = (_pEditView->execute(SCI_CANPASTE) != 0);
enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR);
enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR);
enableCommand(IDM_EDIT_PASTE, canPaste, 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_DELETE, hasSelection, MENU | TOOLBAR);
enableCommand(IDM_EDIT_UPPERCASE, hasSelection, MENU); enableCommand(IDM_EDIT_UPPERCASE, hasSelection, MENU);
enableCommand(IDM_EDIT_LOWERCASE, 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() 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; DocTabView * tabToClose = (whichOne == MAIN_VIEW)?&_mainDocTab:&_subDocTab;
ScintillaEditView * viewToClose = (whichOne == MAIN_VIEW)?&_mainEditView:&_subEditView; ScintillaEditView * viewToClose = (whichOne == MAIN_VIEW)?&_mainEditView:&_subEditView;
@ -2744,24 +2738,33 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) {
} }
int active = tabToClose->getCurrentTabIndex(); int active = tabToClose->getCurrentTabIndex();
if (active == index) { //need an alternative (close real doc, put empty one back 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 (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(); BufferID newID = MainFileManager->newEmptyDocument();
MainFileManager->addBufferReference(newID, viewToClose); MainFileManager->addBufferReference(newID, viewToClose);
tabToClose->setBuffer(0, newID); //can safely use id 0, last (only) tab open tabToClose->setBuffer(0, newID); //can safely use id 0, last (only) tab open
activateBuffer(newID, whichOne); //activate. DocTab already activated but not a problem activateBuffer(newID, whichOne); //activate. DocTab already activated but not a problem
} else { }
else
{
int toActivate = 0; int toActivate = 0;
//activate next doc, otherwise prev if not possible //activate next doc, otherwise prev if not possible
if (active == tabToClose->nbItem() - 1) { //prev if (active == tabToClose->nbItem() - 1) //prev
{
toActivate = active - 1; toActivate = active - 1;
} else { }
else
{
toActivate = active; //activate the 'active' index. Since we remove the tab first, the indices shift (on the right side) 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 tabToClose->deletItemAt((size_t)index); //delete first
activateBuffer(tabToClose->getBufferByIndex(toActivate), whichOne); //then activate. The prevent jumpy tab behaviour activateBuffer(tabToClose->getBufferByIndex(toActivate), whichOne); //then activate. The prevent jumpy tab behaviour
} }
} else { }
else
{
tabToClose->deletItemAt((size_t)index); tabToClose->deletItemAt((size_t)index);
} }

View File

@ -188,7 +188,7 @@ struct LanguageName {
class ScintillaEditView : public Window class ScintillaEditView : public Window
{ {
friend class Notepad_plus; //friend class Notepad_plus;
friend class Finder; friend class Finder;
public: public:
ScintillaEditView() ScintillaEditView()
@ -563,6 +563,7 @@ public:
void bufferUpdated(Buffer * buffer, int mask); void bufferUpdated(Buffer * buffer, int mask);
BufferID getCurrentBufferID() { return _currentBufferID; }; BufferID getCurrentBufferID() { return _currentBufferID; };
Buffer * getCurrentBuffer() { return _currentBuffer; }; Buffer * getCurrentBuffer() { return _currentBuffer; };
void setCurrentBuffer(Buffer *buf2set) { _currentBuffer = buf2set; };
void styleChange(); void styleChange();
void hideLines(); void hideLines();
@ -595,7 +596,9 @@ public:
void mouseWheel(WPARAM wParam, LPARAM lParam) { void mouseWheel(WPARAM wParam, LPARAM lParam) {
scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam); scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam);
}; };
void setHotspotStyle(Style& styleToSet);
void setTabSettings(Lang *lang);
/* /*
pair<size_t, bool> getLineUndoState(size_t currentLine) { pair<size_t, bool> getLineUndoState(size_t currentLine) {
Buffer * buf = getCurrentBuffer(); Buffer * buf = getCurrentBuffer();
@ -674,7 +677,6 @@ protected:
void setKeywords(LangType langType, const char *keywords, int index); void setKeywords(LangType langType, const char *keywords, int index);
void setLexer(int lexerID, LangType langType, int whichList); void setLexer(int lexerID, LangType langType, int whichList);
inline void makeStyle(LangType langType, const TCHAR **keywordArray = NULL); inline void makeStyle(LangType langType, const TCHAR **keywordArray = NULL);
void setHotspotStyle(Style& styleToSet);
void setStyle(Style styleToSet); //NOT by reference (style edited) void setStyle(Style styleToSet); //NOT by reference (style edited)
void setSpecialStyle(const Style & styleToSet); //by reference void setSpecialStyle(const Style & styleToSet); //by reference
void setSpecialIndicator(const Style & styleToSet) { void setSpecialIndicator(const Style & styleToSet) {
@ -907,7 +909,6 @@ protected:
} }
}; };
void setTabSettings(Lang *lang);
pair<int, int> getWordRange(); pair<int, int> getWordRange();
bool expandWordSelection(); bool expandWordSelection();
}; };

View File

@ -29,9 +29,15 @@ void DocumentMap::reloadMap()
Document currentDoc = (*_ppEditView)->execute(SCI_GETDOCPOINTER); Document currentDoc = (*_ppEditView)->execute(SCI_GETDOCPOINTER);
::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETDOCPOINTER, 0, (LPARAM)currentDoc); ::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETDOCPOINTER, 0, (LPARAM)currentDoc);
//
// sync with the current document // 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); _pScintillaEditView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false);
// folding // folding
@ -43,9 +49,10 @@ void DocumentMap::reloadMap()
//initWrapMap(); //initWrapMap();
wrapMap(); wrapMap();
} }
scrollMap(); scrollMap();
} }
} }
bool DocumentMap::needToRecomputeWith() bool DocumentMap::needToRecomputeWith()

Binary file not shown.