Fix reload not trigger restyle.
Fix find in files corrupting Buffer status. Incremental search removing highlighting of closed. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@236 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
5529852d67
commit
1a2e2e0431
@ -251,16 +251,6 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi
|
|||||||
}
|
}
|
||||||
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
||||||
|
|
||||||
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
|
|
||||||
{
|
|
||||||
loadLastSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdLine)
|
|
||||||
{
|
|
||||||
loadCommandlineParams(cmdLine, cmdLineParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
::GetModuleFileName(NULL, _nppPath, MAX_PATH);
|
::GetModuleFileName(NULL, _nppPath, MAX_PATH);
|
||||||
|
|
||||||
if (nppGUI._tabStatus & TAB_MULTILINE)
|
if (nppGUI._tabStatus & TAB_MULTILINE)
|
||||||
@ -269,12 +259,23 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi
|
|||||||
if (!nppGUI._menuBarShow)
|
if (!nppGUI._menuBarShow)
|
||||||
::SetMenu(_hSelf, NULL);
|
::SetMenu(_hSelf, NULL);
|
||||||
|
|
||||||
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
|
||||||
if (cmdLineParams->_isNoTab || (nppGUI._tabStatus & TAB_HIDE))
|
if (cmdLineParams->_isNoTab || (nppGUI._tabStatus & TAB_HIDE))
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, NPPM_HIDETABBAR, 0, TRUE);
|
::SendMessage(_hSelf, NPPM_HIDETABBAR, 0, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
||||||
|
|
||||||
|
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
|
||||||
|
{
|
||||||
|
loadLastSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdLine)
|
||||||
|
{
|
||||||
|
loadCommandlineParams(cmdLine, cmdLineParams);
|
||||||
|
}
|
||||||
|
|
||||||
// Notify plugins that Notepad++ is ready
|
// Notify plugins that Notepad++ is ready
|
||||||
SCNotification scnN;
|
SCNotification scnN;
|
||||||
scnN.nmhdr.code = NPPN_READY;
|
scnN.nmhdr.code = NPPN_READY;
|
||||||
@ -1451,7 +1452,7 @@ bool Notepad_plus::findInFiles(bool isRecursive, bool isInHiddenDir)
|
|||||||
if (id != BUFFER_INVALID) {
|
if (id != BUFFER_INVALID) {
|
||||||
dontClose = true;
|
dontClose = true;
|
||||||
} else {
|
} else {
|
||||||
MainFileManager->loadFile(fileNames.at(i).c_str());
|
id = MainFileManager->loadFile(fileNames.at(i).c_str());
|
||||||
dontClose = false;
|
dontClose = false;
|
||||||
}
|
}
|
||||||
if (id != BUFFER_INVALID) {
|
if (id != BUFFER_INVALID) {
|
||||||
@ -6112,9 +6113,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case WM_DOOPEN:
|
case WM_DOOPEN:
|
||||||
{
|
{
|
||||||
BufferID lastOpened = doOpen((const char *)lParam);
|
BufferID id = doOpen((const char *)lParam);
|
||||||
if (lastOpened != BUFFER_INVALID) {
|
if (id != BUFFER_INVALID) {
|
||||||
switchToFile(lastOpened);
|
return switchToFile(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -8011,11 +8012,7 @@ void Notepad_plus::loadCommandlineParams(const char * commandLine, CmdLineParams
|
|||||||
for (int i = 0 ; i < fnss.size() ; i++)
|
for (int i = 0 ; i < fnss.size() ; i++)
|
||||||
{
|
{
|
||||||
pFn = fnss.getFileName(i);
|
pFn = fnss.getFileName(i);
|
||||||
BufferID bufID = BUFFER_INVALID;
|
BufferID bufID = doOpen(pFn, readOnly);
|
||||||
bool exists = (bufID = MainFileManager->getBufferFromName(pFn)) != BUFFER_INVALID;
|
|
||||||
if (!exists) {
|
|
||||||
bufID = doOpen(pFn, readOnly);
|
|
||||||
}
|
|
||||||
if (bufID == BUFFER_INVALID) //cannot open file
|
if (bufID == BUFFER_INVALID) //cannot open file
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -400,7 +400,10 @@ bool FileManager::reloadBuffer(BufferID id) {
|
|||||||
Buffer * buf = getBufferByID(id);
|
Buffer * buf = getBufferByID(id);
|
||||||
Document doc = buf->getDocument();
|
Document doc = buf->getDocument();
|
||||||
Utf8_16_Read UnicodeConvertor;
|
Utf8_16_Read UnicodeConvertor;
|
||||||
return loadFileData(doc, buf->getFilePath(), &UnicodeConvertor);
|
bool res = loadFileData(doc, buf->getFilePath(), &UnicodeConvertor);
|
||||||
|
if (res)
|
||||||
|
buf->setNeedsLexing(true);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
||||||
|
@ -43,7 +43,8 @@ enum BufferStatusInfo {
|
|||||||
BufferChangeTimestamp = 0x040, //Timestamp was changed
|
BufferChangeTimestamp = 0x040, //Timestamp was changed
|
||||||
BufferChangeFilename = 0x080, //Filename was changed
|
BufferChangeFilename = 0x080, //Filename was changed
|
||||||
BufferChangeRecentTag = 0x100, //Recent tag has changed
|
BufferChangeRecentTag = 0x100, //Recent tag has changed
|
||||||
BufferChangeMask = 0x1FF //Mask: covers all changes
|
BufferChangeLexing = 0x200, //Document needs lexing
|
||||||
|
BufferChangeMask = 0x3FF //Mask: covers all changes
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HeaderLineState {
|
struct HeaderLineState {
|
||||||
@ -300,6 +301,7 @@ public :
|
|||||||
|
|
||||||
void setNeedsLexing(bool lex) {
|
void setNeedsLexing(bool lex) {
|
||||||
_needLexer = lex;
|
_needLexer = lex;
|
||||||
|
doNotify(BufferChangeLexing);
|
||||||
};
|
};
|
||||||
|
|
||||||
//these two return reference count after operation
|
//these two return reference count after operation
|
||||||
|
@ -1528,7 +1528,9 @@ BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDCANCEL :
|
case IDCANCEL :
|
||||||
|
(*(_pFRDlg->_ppEditView))->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_INC);
|
||||||
::SetFocus((*(_pFRDlg->_ppEditView))->getHSelf());
|
::SetFocus((*(_pFRDlg->_ppEditView))->getHSelf());
|
||||||
|
|
||||||
display(false);
|
display(false);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -1087,12 +1087,14 @@ void ScintillaEditView::activateBuffer(BufferID buffer)
|
|||||||
void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) {
|
void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) {
|
||||||
//actually only care about language and lexing etc
|
//actually only care about language and lexing etc
|
||||||
if (buffer == _currentBuffer) {
|
if (buffer == _currentBuffer) {
|
||||||
|
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 & BufferChangeLanguage) {
|
if (mask & BufferChangeLanguage) {
|
||||||
defineDocType(buffer->getLangType());
|
defineDocType(buffer->getLangType());
|
||||||
foldAll(fold_uncollapse);
|
foldAll(fold_uncollapse);
|
||||||
if (buffer->getNeedsLexing()) {
|
|
||||||
restyleBuffer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mask & BufferChangeFormat) {
|
if (mask & BufferChangeFormat) {
|
||||||
execute(SCI_SETEOLMODE, _currentBuffer->getFormat());
|
execute(SCI_SETEOLMODE, _currentBuffer->getFormat());
|
||||||
@ -1116,7 +1118,7 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) {
|
|||||||
|
|
||||||
void ScintillaEditView::collapse(int level2Collapse, bool mode)
|
void ScintillaEditView::collapse(int level2Collapse, bool mode)
|
||||||
{
|
{
|
||||||
execute(SCI_COLOURISE, 0, -1); //TODO: is this needed?
|
//execute(SCI_COLOURISE, 0, -1); //TODO: is this needed?
|
||||||
int maxLine = execute(SCI_GETLINECOUNT);
|
int maxLine = execute(SCI_GETLINECOUNT);
|
||||||
|
|
||||||
for (int line = 0; line < maxLine; line++)
|
for (int line = 0; line < maxLine; line++)
|
||||||
@ -1136,7 +1138,7 @@ void ScintillaEditView::collapse(int level2Collapse, bool mode)
|
|||||||
|
|
||||||
void ScintillaEditView::foldCurrentPos(bool mode)
|
void ScintillaEditView::foldCurrentPos(bool mode)
|
||||||
{
|
{
|
||||||
execute(SCI_COLOURISE, 0, -1);
|
//execute(SCI_COLOURISE, 0, -1);
|
||||||
int currentLine = this->getCurrentLineNumber();
|
int currentLine = this->getCurrentLineNumber();
|
||||||
|
|
||||||
int headerLine;
|
int headerLine;
|
||||||
@ -1157,7 +1159,7 @@ void ScintillaEditView::foldCurrentPos(bool mode)
|
|||||||
|
|
||||||
void ScintillaEditView::foldAll(bool mode)
|
void ScintillaEditView::foldAll(bool mode)
|
||||||
{
|
{
|
||||||
execute(SCI_COLOURISE, 0, -1);
|
//execute(SCI_COLOURISE, 0, -1);
|
||||||
int maxLine = execute(SCI_GETLINECOUNT);
|
int maxLine = execute(SCI_GETLINECOUNT);
|
||||||
|
|
||||||
for (int line = 0; line < maxLine; line++)
|
for (int line = 0; line < maxLine; line++)
|
||||||
|
Loading…
Reference in New Issue
Block a user