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);
|
||||
|
||||
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
|
||||
{
|
||||
loadLastSession();
|
||||
}
|
||||
|
||||
if (cmdLine)
|
||||
{
|
||||
loadCommandlineParams(cmdLine, cmdLineParams);
|
||||
}
|
||||
|
||||
::GetModuleFileName(NULL, _nppPath, MAX_PATH);
|
||||
|
||||
if (nppGUI._tabStatus & TAB_MULTILINE)
|
||||
@ -269,12 +259,23 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi
|
||||
if (!nppGUI._menuBarShow)
|
||||
::SetMenu(_hSelf, NULL);
|
||||
|
||||
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
|
||||
if (cmdLineParams->_isNoTab || (nppGUI._tabStatus & TAB_HIDE))
|
||||
{
|
||||
::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
|
||||
SCNotification scnN;
|
||||
scnN.nmhdr.code = NPPN_READY;
|
||||
@ -1451,7 +1452,7 @@ bool Notepad_plus::findInFiles(bool isRecursive, bool isInHiddenDir)
|
||||
if (id != BUFFER_INVALID) {
|
||||
dontClose = true;
|
||||
} else {
|
||||
MainFileManager->loadFile(fileNames.at(i).c_str());
|
||||
id = MainFileManager->loadFile(fileNames.at(i).c_str());
|
||||
dontClose = false;
|
||||
}
|
||||
if (id != BUFFER_INVALID) {
|
||||
@ -6112,9 +6113,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
|
||||
case WM_DOOPEN:
|
||||
{
|
||||
BufferID lastOpened = doOpen((const char *)lParam);
|
||||
if (lastOpened != BUFFER_INVALID) {
|
||||
switchToFile(lastOpened);
|
||||
BufferID id = doOpen((const char *)lParam);
|
||||
if (id != BUFFER_INVALID) {
|
||||
return switchToFile(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -8011,11 +8012,7 @@ void Notepad_plus::loadCommandlineParams(const char * commandLine, CmdLineParams
|
||||
for (int i = 0 ; i < fnss.size() ; i++)
|
||||
{
|
||||
pFn = fnss.getFileName(i);
|
||||
BufferID bufID = BUFFER_INVALID;
|
||||
bool exists = (bufID = MainFileManager->getBufferFromName(pFn)) != BUFFER_INVALID;
|
||||
if (!exists) {
|
||||
bufID = doOpen(pFn, readOnly);
|
||||
}
|
||||
BufferID bufID = doOpen(pFn, readOnly);
|
||||
if (bufID == BUFFER_INVALID) //cannot open file
|
||||
continue;
|
||||
|
||||
|
@ -400,7 +400,10 @@ bool FileManager::reloadBuffer(BufferID id) {
|
||||
Buffer * buf = getBufferByID(id);
|
||||
Document doc = buf->getDocument();
|
||||
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) {
|
||||
|
@ -43,7 +43,8 @@ enum BufferStatusInfo {
|
||||
BufferChangeTimestamp = 0x040, //Timestamp was changed
|
||||
BufferChangeFilename = 0x080, //Filename was 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 {
|
||||
@ -300,6 +301,7 @@ public :
|
||||
|
||||
void setNeedsLexing(bool lex) {
|
||||
_needLexer = lex;
|
||||
doNotify(BufferChangeLexing);
|
||||
};
|
||||
|
||||
//these two return reference count after operation
|
||||
|
@ -1528,7 +1528,9 @@ BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL :
|
||||
(*(_pFRDlg->_ppEditView))->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_INC);
|
||||
::SetFocus((*(_pFRDlg->_ppEditView))->getHSelf());
|
||||
|
||||
display(false);
|
||||
return TRUE;
|
||||
|
||||
|
@ -1087,12 +1087,14 @@ 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 & BufferChangeLexing) {
|
||||
if (buffer->getNeedsLexing()) {
|
||||
restyleBuffer(); //sets to false, this will apply to any other view aswell
|
||||
} //else nothing, otherwise infinite loop
|
||||
}
|
||||
if (mask & BufferChangeLanguage) {
|
||||
defineDocType(buffer->getLangType());
|
||||
foldAll(fold_uncollapse);
|
||||
if (buffer->getNeedsLexing()) {
|
||||
restyleBuffer();
|
||||
}
|
||||
}
|
||||
if (mask & BufferChangeFormat) {
|
||||
execute(SCI_SETEOLMODE, _currentBuffer->getFormat());
|
||||
@ -1116,7 +1118,7 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) {
|
||||
|
||||
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);
|
||||
|
||||
for (int line = 0; line < maxLine; line++)
|
||||
@ -1136,7 +1138,7 @@ void ScintillaEditView::collapse(int level2Collapse, bool mode)
|
||||
|
||||
void ScintillaEditView::foldCurrentPos(bool mode)
|
||||
{
|
||||
execute(SCI_COLOURISE, 0, -1);
|
||||
//execute(SCI_COLOURISE, 0, -1);
|
||||
int currentLine = this->getCurrentLineNumber();
|
||||
|
||||
int headerLine;
|
||||
@ -1157,7 +1159,7 @@ void ScintillaEditView::foldCurrentPos(bool mode)
|
||||
|
||||
void ScintillaEditView::foldAll(bool mode)
|
||||
{
|
||||
execute(SCI_COLOURISE, 0, -1);
|
||||
//execute(SCI_COLOURISE, 0, -1);
|
||||
int maxLine = execute(SCI_GETLINECOUNT);
|
||||
|
||||
for (int line = 0; line < maxLine; line++)
|
||||
|
Loading…
Reference in New Issue
Block a user