[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="16" name="Traitement des espacements"/>
<Item posX="1" posY="17" name="Collage special"/>
<Item posX="2" posY="14" name="Marquer tout"/>
<Item posX="2" posY="15" name="Enlever toutes les marques"/>
<Item posX="2" posY="16" name="Aller vers le haut"/>
<Item posX="2" posY="17" name="Aller vers le bas"/>
<Item posX="2" posY="16" name="Marquer tout"/>
<Item posX="2" posY="17" name="Enlever toutes les marques"/>
<Item posX="2" posY="18" name="Aller vers le haut"/>
<Item posX="2" posY="19" name="Aller vers le bas"/>
<Item posX="2" posY="21" name="Signet"/>
<Item posX="3" posY="4" name="Symbole spéciaux"/>
<Item posX="3" posY="5" name="Zoom"/>

View File

@ -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);
}

View File

@ -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();
@ -596,6 +597,8 @@ public:
scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam);
};
void setHotspotStyle(Style& styleToSet);
void setTabSettings(Lang *lang);
/*
pair<size_t, bool> 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<int, int> getWordRange();
bool expandWordSelection();
};

View File

@ -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();
scrollMap();
}
}
bool DocumentMap::needToRecomputeWith()

Binary file not shown.