Fix folding state lost on the next starup issue

Any setting other than the default setting "for new opened document - UTF8 apply to opened ansi files" will cause C/C++ and other some languages (not for xml though) folding lost on startup.

Fix #4103
This commit is contained in:
Don HO 2020-04-08 17:22:44 +02:00
parent 3de506bf48
commit a09c0a17db
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 4 additions and 3 deletions

View File

@ -1946,14 +1946,15 @@ void ScintillaEditView::activateBuffer(BufferID buffer)
restyleBuffer(); restyleBuffer();
} }
// Everything should be updated, but the language
bufferUpdated(_currentBuffer, (BufferChangeMask & ~BufferChangeLanguage));
// restore the collapsed info // restore the collapsed info
const std::vector<size_t> & lineStateVectorNew = newBuf->getHeaderLineState(this); const std::vector<size_t> & lineStateVectorNew = newBuf->getHeaderLineState(this);
syncFoldStateWith(lineStateVectorNew); syncFoldStateWith(lineStateVectorNew);
restoreCurrentPosPreStep(); restoreCurrentPosPreStep();
bufferUpdated(_currentBuffer, (BufferChangeMask & ~BufferChangeLanguage)); //everything should be updated, but the language (which undoes some operations done here like folding)
//setup line number margin //setup line number margin
int numLines = static_cast<int32_t>(execute(SCI_GETLINECOUNT)); int numLines = static_cast<int32_t>(execute(SCI_GETLINECOUNT));

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad++ project
// Copyright (C)2003 Don HO <don.h@free.fr> // Copyright (C)2020 Don HO <don.h@free.fr>
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU General Public License