mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
[NEW_FEATURE] (Author: FLS) Enhance the performance of switching files if folding is applied.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1045 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
e2e7703241
commit
434638c611
@ -1598,18 +1598,20 @@ void ScintillaEditView::activateBuffer(BufferID buffer)
|
|||||||
|
|
||||||
void ScintillaEditView::getCurrentFoldStates(std::vector<size_t> & lineStateVector)
|
void ScintillaEditView::getCurrentFoldStates(std::vector<size_t> & lineStateVector)
|
||||||
{
|
{
|
||||||
int maxLine = execute(SCI_GETLINECOUNT);
|
//-- FLS: xCodeOptimization1304: For active document get folding state from Scintilla.
|
||||||
|
//-- The code using SCI_CONTRACTEDFOLDNEXT is usually 10%-50% faster than checking each line of the document!!
|
||||||
|
int contractedFoldHeaderLine = 0;
|
||||||
|
|
||||||
for (int line = 0; line < maxLine; line++)
|
do {
|
||||||
{
|
contractedFoldHeaderLine = execute(SCI_CONTRACTEDFOLDNEXT, contractedFoldHeaderLine);
|
||||||
int level = execute(SCI_GETFOLDLEVEL, line);
|
if (contractedFoldHeaderLine != -1)
|
||||||
if (level & SC_FOLDLEVELHEADERFLAG)
|
|
||||||
{
|
{
|
||||||
bool expanded = isFolded(line);
|
//-- Store contracted line
|
||||||
if (!expanded)
|
lineStateVector.push_back(contractedFoldHeaderLine);
|
||||||
lineStateVector.push_back(line);
|
//-- Start next search with next line
|
||||||
|
contractedFoldHeaderLine++;
|
||||||
}
|
}
|
||||||
}
|
} while (contractedFoldHeaderLine != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew)
|
void ScintillaEditView::syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user