Skip to content

Commit

Permalink
Improve performance: Optimize activateBuffer function
Browse files Browse the repository at this point in the history
  • Loading branch information
donho committed Jan 3, 2025
1 parent c17d1d4 commit c5dd85c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 26 additions & 1 deletion PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,8 @@ void ScintillaEditView::activateBuffer(BufferID buffer, bool force)

restoreCurrentPosPreStep();

runMarkers(true, 0, true, false);
//runMarkers(true, 0, true, false);
restoreHiddenLines();

setCRLF();

Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions PowerEditor/src/ScintillaComponent/ScintillaEditView.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ friend class Finder;
bool markerMarginClick(intptr_t lineNumber); //true if it did something
void notifyMarkers(Buffer * buf, bool isHide, size_t location, bool del);
void runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete);
void restoreHiddenLines();

bool hasSelection() const { return !execute(SCI_GETSELECTIONEMPTY); };

Expand Down

0 comments on commit c5dd85c

Please sign in to comment.