mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 23:34:44 +02:00
Improve performance: Optimize activateBuffer function
Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15952#issuecomment-2567521808 Close #16010
This commit is contained in:
parent
c17d1d428d
commit
c5dd85cd93
@ -2358,7 +2358,8 @@ void ScintillaEditView::activateBuffer(BufferID buffer, bool force)
|
|||||||
|
|
||||||
restoreCurrentPosPreStep();
|
restoreCurrentPosPreStep();
|
||||||
|
|
||||||
runMarkers(true, 0, true, false);
|
//runMarkers(true, 0, true, false);
|
||||||
|
restoreHiddenLines();
|
||||||
|
|
||||||
setCRLF();
|
setCRLF();
|
||||||
|
|
||||||
@ -4226,6 +4227,30 @@ void ScintillaEditView::runMarkers(bool doHide, size_t searchStart, bool endOfDo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaEditView::restoreHiddenLines()
|
||||||
|
{
|
||||||
|
int line = 0;
|
||||||
|
|
||||||
|
while (line != -1)
|
||||||
|
{
|
||||||
|
line = static_cast<int>(execute(SCI_MARKERNEXT, line, 1 << MARK_HIDELINESBEGIN));
|
||||||
|
|
||||||
|
if (line != -1)
|
||||||
|
{
|
||||||
|
int startHiding = line + 1;
|
||||||
|
line = static_cast<int>(execute(SCI_MARKERNEXT, line, 1 << MARK_HIDELINESEND));
|
||||||
|
|
||||||
|
if (line != -1)
|
||||||
|
{
|
||||||
|
execute(SCI_HIDELINES, startHiding, line - 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ScintillaEditView::setTabSettings(Lang* lang)
|
void ScintillaEditView::setTabSettings(Lang* lang)
|
||||||
{
|
{
|
||||||
|
@ -815,6 +815,7 @@ public:
|
|||||||
bool markerMarginClick(intptr_t lineNumber); //true if it did something
|
bool markerMarginClick(intptr_t lineNumber); //true if it did something
|
||||||
void notifyMarkers(Buffer * buf, bool isHide, size_t location, bool del);
|
void notifyMarkers(Buffer * buf, bool isHide, size_t location, bool del);
|
||||||
void runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete);
|
void runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete);
|
||||||
|
void restoreHiddenLines();
|
||||||
|
|
||||||
bool hasSelection() const { return !execute(SCI_GETSELECTIONEMPTY); };
|
bool hasSelection() const { return !execute(SCI_GETSELECTIONEMPTY); };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user