From 83755ca15584bddf8e83cffcc8a5c71ce1f594e2 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 17 Feb 2025 13:37:43 +0100 Subject: [PATCH] Improve folding/unfolding performance for large files - Use the Scintilla dedicated command SCI_FOLDALL to replace the inefficient loop for "Fold All" command. - Fix "Fold level" & switching back to large files folding performance. - Refactoring the hide/show lines functions. Note that there might be a regression of URL link: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/16200/files#r1961937279 The commit is based on code of #16064. Fix #16064, close #16200 --- PowerEditor/src/NppCommands.cpp | 4 +- PowerEditor/src/NppNotification.cpp | 48 +-- PowerEditor/src/ScintillaComponent/Buffer.cpp | 4 +- .../src/ScintillaComponent/FindReplaceDlg.cpp | 2 +- .../ScintillaComponent/ScintillaEditView.cpp | 343 ++++++++++-------- .../ScintillaComponent/ScintillaEditView.h | 49 +-- .../WinControls/DocumentMap/documentMap.cpp | 2 +- 7 files changed, 242 insertions(+), 210 deletions(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 6316f8ca4..2387a78b1 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2227,7 +2227,7 @@ void Notepad_plus::command(int id) case IDM_VIEW_FOLD_7: case IDM_VIEW_FOLD_8: _isFolding = true; // So we can ignore events while folding is taking place - _pEditView->collapse(id - IDM_VIEW_FOLD - 1, fold_collapse); + _pEditView->foldLevel(id - IDM_VIEW_FOLD - 1, fold_collapse); _isFolding = false; break; @@ -2240,7 +2240,7 @@ void Notepad_plus::command(int id) case IDM_VIEW_UNFOLD_7: case IDM_VIEW_UNFOLD_8: _isFolding = true; // So we can ignore events while folding is taking place - _pEditView->collapse(id - IDM_VIEW_UNFOLD - 1, fold_expand); + _pEditView->foldLevel(id - IDM_VIEW_UNFOLD - 1, fold_expand); _isFolding = false; break; diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index b2f681679..2c385651c 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -147,7 +147,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) } else if ((notification->margin == ScintillaEditView::_SC_MARGE_SYMBOL) && !notification->modifiers) { - if (!_pEditView->markerMarginClick(lineClick)) + if (!_pEditView->hidelineMarkerClicked(lineClick)) bookmarkToggle(lineClick); } break; @@ -180,28 +180,6 @@ BOOL Notepad_plus::notify(SCNotification *notification) break; } - case SCN_FOLDINGSTATECHANGED: - { - if ((notification->nmhdr.hwndFrom == _mainEditView.getHSelf()) || (notification->nmhdr.hwndFrom == _subEditView.getHSelf())) - { - size_t lineClicked = notification->line; - - if (!_isFolding) - { - int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL; - Buffer* currentBuf = _pEditView->getCurrentBuffer(); - if (urlAction != urlDisable && currentBuf->allowClickableLink()) - { - addHotSpot(); - } - } - - if (_pDocMap) - _pDocMap->fold(lineClicked, _pEditView->isFolded(lineClicked)); - } - return TRUE; - } - case SCN_CHARADDED: { if (!notifyView) return FALSE; @@ -582,6 +560,30 @@ BOOL Notepad_plus::notify(SCNotification *notification) // ======= End of SCN_* // + case SCN_FOLDINGSTATECHANGED: // Notification not part of Scintilla, but Notepad++ added + { + if ((notification->nmhdr.hwndFrom == _mainEditView.getHSelf()) || (notification->nmhdr.hwndFrom == _subEditView.getHSelf())) + { + size_t lineClicked = notification->line; + + /* + if (!_isFolding) + { + int urlAction = (NppParameters::getInstance()).getNppGUI()._styleURL; + Buffer* currentBuf = _pEditView->getCurrentBuffer(); + if (urlAction != urlDisable && currentBuf->allowClickableLink()) + { + addHotSpot(); + } + } + */ + + if (_pDocMap) + _pDocMap->fold(lineClicked, _pEditView->isFolded(lineClicked)); + } + + return TRUE; + } case TCN_MOUSEHOVERING: case TCN_MOUSEHOVERSWITCHING: diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index 3e20a5a67..267379990 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -649,13 +649,13 @@ void Buffer::setHideLineChanged(bool isHide, size_t location) { //First run through all docs without removing markers for (int i = 0; i < _references; ++i) - _referees.at(i)->notifyMarkers(this, isHide, location, false); // (i == _references-1)); + _referees.at(i)->notifyHidelineMarkers(this, isHide, location, false); // (i == _references-1)); if (!isHide) // no deleting if hiding lines { //Then all docs to remove markers. for (int i = 0; i < _references; ++i) - _referees.at(i)->notifyMarkers(this, isHide, location, true); + _referees.at(i)->notifyHidelineMarkers(this, isHide, location, true); } } diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 3d3f0dc10..23851c3eb 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -5581,7 +5581,7 @@ void Finder::beginNewFilesSearch() _nbFoundFiles = 0; // fold all old searches (1st level only) - _scintView.collapse(searchHeaderLevel - SC_FOLDLEVELBASE, fold_collapse); + _scintView.foldLevel(searchHeaderLevel - SC_FOLDLEVELBASE, fold_collapse); } void Finder::finishFilesSearch(int count, int searchedCount, bool searchedEntireNotSelection, const FindOption* pFindOpt) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index da880cbbb..e56c90cbb 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -2399,10 +2399,7 @@ void ScintillaEditView::activateBuffer(BufferID buffer, bool force) syncFoldStateWith(lineStateVectorNew); restoreCurrentPosPreStep(); - - //runMarkers(true, 0, true, false); restoreHiddenLines(); - setCRLF(); NppParameters& nppParam = NppParameters::getInstance(); @@ -2448,10 +2445,24 @@ void ScintillaEditView::getCurrentFoldStates(std::vector & lineStateVect void ScintillaEditView::syncFoldStateWith(const std::vector & lineStateVectorNew) { size_t nbLineState = lineStateVectorNew.size(); - for (size_t i = 0 ; i < nbLineState ; ++i) + + if (nbLineState > 0) { - auto line = lineStateVectorNew.at(i); - fold(line, false); + if (nbLineState > MAX_FOLD_LINES_MORE_THAN) // Block WM_SETREDRAW messages + ::SendMessage(_hSelf, WM_SETREDRAW, FALSE, 0); + + for (size_t i = 0; i < nbLineState; ++i) + { + auto line = lineStateVectorNew.at(i); + fold(line, fold_collapse, false); + } + + if (nbLineState > MAX_FOLD_LINES_MORE_THAN) + { + ::SendMessage(_hSelf, WM_SETREDRAW, TRUE, 0); + execute(SCI_SCROLLCARET); + ::InvalidateRect(_hSelf, nullptr, TRUE); + } } } @@ -2537,16 +2548,19 @@ struct FoldLevelStack } -void ScintillaEditView::collapseFoldIndentationBased(int level2Collapse, bool mode) +void ScintillaEditView::foldIndentationBasedLevel(int level2Collapse, bool mode) { - execute(SCI_COLOURISE, 0, -1); - FoldLevelStack levelStack; ++level2Collapse; // 1-based level number const intptr_t maxLine = execute(SCI_GETLINECOUNT); intptr_t line = 0; + if (maxLine > MAX_FOLD_LINES_MORE_THAN) + { + ::SendMessage(_hSelf, WM_SETREDRAW, FALSE, 0); + } + while (line < maxLine) { intptr_t level = execute(SCI_GETFOLDLEVEL, line); @@ -2568,21 +2582,34 @@ void ScintillaEditView::collapseFoldIndentationBased(int level2Collapse, bool mo ++line; } - runMarkers(true, 0, true, false); + if (maxLine > MAX_FOLD_LINES_MORE_THAN) + { + ::SendMessage(_hSelf, WM_SETREDRAW, TRUE, 0); + execute(SCI_SCROLLCARET); + ::InvalidateRect(_hSelf, nullptr, TRUE); + } + + if (mode == fold_expand) + hideMarkedLines(0, true); } -void ScintillaEditView::collapse(int level2Collapse, bool mode) + +void ScintillaEditView::foldLevel(int level2Collapse, bool mode) { + if (isFoldIndentationBased()) { - collapseFoldIndentationBased(level2Collapse, mode); + foldIndentationBasedLevel(level2Collapse, mode); return; } - execute(SCI_COLOURISE, 0, -1); - intptr_t maxLine = execute(SCI_GETLINECOUNT); + if (maxLine > MAX_FOLD_LINES_MORE_THAN) + { + ::SendMessage(_hSelf, WM_SETREDRAW, FALSE, 0); + } + for (int line = 0; line < maxLine; ++line) { intptr_t level = execute(SCI_GETFOLDLEVEL, line); @@ -2597,7 +2624,15 @@ void ScintillaEditView::collapse(int level2Collapse, bool mode) } } - runMarkers(true, 0, true, false); + if (maxLine > MAX_FOLD_LINES_MORE_THAN) + { + ::SendMessage(_hSelf, WM_SETREDRAW, TRUE, 0); + execute(SCI_SCROLLCARET); + ::InvalidateRect(_hSelf, nullptr, TRUE); + } + + if (mode == fold_expand) + hideMarkedLines(0, true); } void ScintillaEditView::foldCurrentPos(bool mode) @@ -2626,14 +2661,8 @@ bool ScintillaEditView::isCurrentLineFolded() const return !isExpanded; } -void ScintillaEditView::fold(size_t line, bool mode) +void ScintillaEditView::fold(size_t line, bool mode, bool shouldBeNotified/* = true*/) { - auto endStyled = execute(SCI_GETENDSTYLED); - auto len = execute(SCI_GETTEXTLENGTH); - - if (endStyled < len) - execute(SCI_COLOURISE, 0, -1); - intptr_t headerLine; auto level = execute(SCI_GETFOLDLEVEL, line); @@ -2650,27 +2679,27 @@ void ScintillaEditView::fold(size_t line, bool mode) { execute(SCI_TOGGLEFOLD, headerLine); - SCNotification scnN{}; - scnN.nmhdr.code = SCN_FOLDINGSTATECHANGED; - scnN.nmhdr.hwndFrom = _hSelf; - scnN.nmhdr.idFrom = 0; - scnN.line = headerLine; - scnN.foldLevelNow = isFolded(headerLine)?1:0; //folded:1, unfolded:0 - - ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast(&scnN)); + if (shouldBeNotified) + { + SCNotification scnN{}; + scnN.nmhdr.code = SCN_FOLDINGSTATECHANGED; + scnN.nmhdr.hwndFrom = _hSelf; + scnN.nmhdr.idFrom = 0; + scnN.line = headerLine; + scnN.foldLevelNow = isFolded(headerLine) ? 1 : 0; //folded:1, unfolded:0 + ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast(&scnN)); + } } } void ScintillaEditView::foldAll(bool mode) { - auto maxLine = execute(SCI_GETLINECOUNT); + execute(SCI_FOLDALL, (mode == fold_expand ? SC_FOLDACTION_EXPAND : SC_FOLDACTION_CONTRACT) | SC_FOLDACTION_CONTRACT_EVERY_LEVEL, 0); - for (int line = 0; line < maxLine; ++line) + if (mode == fold_expand) { - auto level = execute(SCI_GETFOLDLEVEL, line); - if (level & SC_FOLDLEVELHEADERFLAG) - if (isFolded(line) != mode) - fold(line, mode); + hideMarkedLines(0, true); + execute(SCI_SCROLLCARET); } } @@ -3015,7 +3044,9 @@ void ScintillaEditView::marginClick(Sci_Position position, int modifiers) // Toggle this line bool mode = isFolded(lineClick); fold(lineClick, !mode); - runMarkers(true, lineClick, true, false); + + if (!mode == fold_expand) // after toggling + hideMarkedLines(lineClick, true); } } } @@ -3067,7 +3098,8 @@ void ScintillaEditView::expand(size_t& line, bool doExpand, bool force, intptr_t ++line; } - runMarkers(true, 0, true, false); + if (doExpand) + hideMarkedLines(0, true); } @@ -4015,19 +4047,21 @@ void ScintillaEditView::scrollPosToCenter(size_t pos) void ScintillaEditView::hideLines() { - //Folding can screw up hide lines badly if it unfolds a hidden section. - //Adding runMarkers(hide, foldstart) directly (folding on single document) can help + // Unfolding can screw up hide lines badly if it unfolds a hidden section. + // Using hideMarkedLines() after unfolding can help - //Special func on buffer. If markers are added, create notification with location of start, and hide bool set to true size_t startLine = execute(SCI_LINEFROMPOSITION, execute(SCI_GETSELECTIONSTART)); size_t endLine = execute(SCI_LINEFROMPOSITION, execute(SCI_GETSELECTIONEND)); - //perform range check: cannot hide very first and very last lines - //Offset them one off the edges, and then check if they are within the reasonable + + // perform range check: cannot hide very first and very last lines + // Offset them one off the edges, and then check if they are within the reasonable size_t nbLines = execute(SCI_GETLINECOUNT); if (nbLines < 3) return; //cannot possibly hide anything + if (!startLine) ++startLine; + if (endLine == (nbLines-1)) --endLine; @@ -4064,8 +4098,10 @@ void ScintillaEditView::hideLines() // Previous markers must be removed in the selected region: removeMarker(startMarker, 1 << MARK_HIDELINESBEGIN); + for (size_t i = startLine; i <= endLine; ++i) removeMarker(i, (1 << MARK_HIDELINESBEGIN) | (1 << MARK_HIDELINESEND)); + removeMarker(endMarker, 1 << MARK_HIDELINESEND); // When hiding lines just below/above other hidden lines, @@ -4100,7 +4136,7 @@ void ScintillaEditView::hideLines() _currentBuffer->setHideLineChanged(true, startMarker); } -bool ScintillaEditView::markerMarginClick(intptr_t lineNumber) +bool ScintillaEditView::hidelineMarkerClicked(intptr_t lineNumber) { auto state = execute(SCI_MARKERGET, lineNumber); bool openPresent = (state & (1 << MARK_HIDELINESBEGIN)) != 0; @@ -4139,136 +4175,148 @@ bool ScintillaEditView::markerMarginClick(intptr_t lineNumber) return true; } -void ScintillaEditView::notifyMarkers(Buffer * buf, bool isHide, size_t location, bool del) +void ScintillaEditView::notifyHidelineMarkers(Buffer * buf, bool isHide, size_t location, bool del) { if (buf != _currentBuffer) //if not visible buffer dont do a thing return; - runMarkers(isHide, location, false, del); + + if (isHide) + hideMarkedLines(location, false); + else + showHiddenLines(location, false, del); } //Run through full document. When switching in or opening folding //hide is false only when user click on margin -void ScintillaEditView::runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete) -{ - //Removes markers if opening - /* - AllLines = (start,ENDOFDOCUMENT) - Hide: - Run through all lines. - Find open hiding marker: - set hiding start - Find closing: - if (hiding): - Hide lines between now and start - if (endOfDoc = false) - return - else - search for other hidden sections - Show: - Run through all lines - Find open hiding marker - set last start - Find closing: - Show from last start. Stop. - Find closed folding header: - Show from last start to folding header - Skip to LASTCHILD - Set last start to lastchild - */ +//Removes markers if opening +/* +AllLines = (start,ENDOFDOCUMENT) +Hide: + Run through all lines. + Find open hiding marker: + set hiding start + Find closing: + if (hiding): + Hide lines between now and start + if (endOfDoc = false) + return + else + search for other hidden sections + +Show: + Run through all lines + Find open hiding marker + set last start + Find closing: + Show from last start. Stop. + Find closed folding header: + Show from last start to folding header + Skip to LASTCHILD + Set last start to lastchild +*/ + +void ScintillaEditView::hideMarkedLines(size_t searchStart, bool toEndOfDoc) +{ size_t maxLines = execute(SCI_GETLINECOUNT); - if (doHide) + + auto startHiding = searchStart; + bool isInSection = false; + + for (auto i = searchStart; i < maxLines; ++i) { - auto startHiding = searchStart; - bool isInSection = false; - for (auto i = searchStart; i < maxLines; ++i) + auto state = execute(SCI_MARKERGET, i); + if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) { - auto state = execute(SCI_MARKERGET, i); - if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) + if (isInSection) { - if (isInSection) + execute(SCI_HIDELINES, startHiding, i-1); + if (!toEndOfDoc) { - execute(SCI_HIDELINES, startHiding, i-1); - if (!endOfDoc) - { - return; //done, only single section requested - } //otherwise keep going - } + return; //done, only single section requested + } //otherwise keep going + } + isInSection = false; + } + + if ((state & (1 << MARK_HIDELINESBEGIN)) != 0) + { + isInSection = true; + startHiding = i+1; + } + + } +} + +void ScintillaEditView::showHiddenLines(size_t searchStart, bool toEndOfDoc, bool doDelete) +{ + size_t maxLines = execute(SCI_GETLINECOUNT); + + auto startShowing = searchStart; + bool isInSection = false; + for (auto i = searchStart; i < maxLines; ++i) + { + auto state = execute(SCI_MARKERGET, i); + if ((state & (1 << MARK_HIDELINESBEGIN)) != 0 && !isInSection) + { + isInSection = true; + if (doDelete) + { + execute(SCI_MARKERDELETE, i, MARK_HIDELINESBEGIN); + } + else + { + startShowing = i + 1; + } + } + else if ( (state & (1 << MARK_HIDELINESEND)) != 0) + { + if (doDelete) + { + execute(SCI_MARKERDELETE, i, MARK_HIDELINESEND); + if (!toEndOfDoc) + { + return; //done, only single section requested + } //otherwise keep going isInSection = false; } - if ((state & (1 << MARK_HIDELINESBEGIN)) != 0) + else if (isInSection) { - isInSection = true; - startHiding = i+1; - } - - } - } - else - { - auto startShowing = searchStart; - bool isInSection = false; - for (auto i = searchStart; i < maxLines; ++i) - { - auto state = execute(SCI_MARKERGET, i); - if ((state & (1 << MARK_HIDELINESBEGIN)) != 0 && !isInSection) - { - isInSection = true; - if (doDelete) - { - execute(SCI_MARKERDELETE, i, MARK_HIDELINESBEGIN); - } - else - { - startShowing = i + 1; - } - } - else if ( (state & (1 << MARK_HIDELINESEND)) != 0) - { - if (doDelete) - { - execute(SCI_MARKERDELETE, i, MARK_HIDELINESEND); - if (!endOfDoc) + if (startShowing >= i) + { //because of fold skipping, we passed the close tag. In that case we cant do anything + if (!toEndOfDoc) { - return; //done, only single section requested - } //otherwise keep going - isInSection = false; - } - else if (isInSection) - { - if (startShowing >= i) - { //because of fold skipping, we passed the close tag. In that case we cant do anything - if (!endOfDoc) - { - return; - } - else - { - isInSection = false; // assume we passed the close tag - continue; - } + return; } - execute(SCI_SHOWLINES, startShowing, i-1); - if (!endOfDoc) + else { - return; //done, only single section requested - } //otherwise keep going - isInSection = false; + isInSection = false; // assume we passed the close tag + continue; + } } - } - auto levelLine = execute(SCI_GETFOLDLEVEL, i, 0); - if (levelLine & SC_FOLDLEVELHEADERFLAG) - { //fold section. Dont show lines if fold is closed - if (isInSection && !isFolded(i)) + execute(SCI_SHOWLINES, startShowing, i-1); + + if (!toEndOfDoc) { - execute(SCI_SHOWLINES, startShowing, i); - } + return; //done, only single section requested + } //otherwise keep going + isInSection = false; + } + } + + auto levelLine = execute(SCI_GETFOLDLEVEL, i, 0); + if (levelLine & SC_FOLDLEVELHEADERFLAG) + { //fold section. Dont show lines if fold is closed + if (isInSection && !isFolded(i)) + { + execute(SCI_SHOWLINES, startShowing, i); } } } } + void ScintillaEditView::restoreHiddenLines() { int line = 0; @@ -4285,7 +4333,6 @@ void ScintillaEditView::restoreHiddenLines() if (line != -1) { execute(SCI_HIDELINES, startHiding, line - 1); - } } } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index c71a77cdf..9849539e3 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -68,8 +68,6 @@ typedef void * SCINTILLA_PTR; #define WM_FINDINPROJECTS (SCINTILLA_USER + 15) #define WM_REPLACEINPROJECTS (SCINTILLA_USER + 16) -const int NB_FOLDER_STATE = 7; - // Codepage const int CP_CHINESE_TRADITIONAL = 950; const int CP_CHINESE_SIMPLIFIED = 936; @@ -89,9 +87,13 @@ const int CP_GREEK = 1253; #define LIST_7 128 #define LIST_8 256 + const bool fold_expand = true; const bool fold_collapse = false; + +const int NB_FOLDER_STATE = 7; #define MAX_FOLD_COLLAPSE_LEVEL 8 +#define MAX_FOLD_LINES_MORE_THAN 99 #define MODEVENTMASK_OFF 0 @@ -454,8 +456,7 @@ public: void activateBuffer(BufferID buffer, bool force); - void getCurrentFoldStates(std::vector & lineStateVector); - void syncFoldStateWith(const std::vector & lineStateVectorNew); + void getText(char *dest, size_t start, size_t end) const; void getGenericText(wchar_t *dest, size_t destlen, size_t start, size_t end) const; @@ -740,8 +741,6 @@ public: void updateLineNumberWidth(); void performGlobalStyles(); - void expand(size_t& line, bool doExpand, bool force = false, intptr_t visLevels = 0, intptr_t level = -1); - std::pair getSelectionLinesRange(intptr_t selectionNumber = -1) const; void currentLinesUp() const; void currentLinesDown() const; @@ -775,14 +774,18 @@ public: ::MessageBox(_hSelf, L"This function needs a newer OS version.", L"Change Case Error", MB_OK | MB_ICONHAND); }; + void getCurrentFoldStates(std::vector & lineStateVector); + void syncFoldStateWith(const std::vector & lineStateVectorNew); bool isFoldIndentationBased() const; - void collapseFoldIndentationBased(int level2Collapse, bool mode); - void collapse(int level2Collapse, bool mode); + void foldIndentationBasedLevel(int level, bool mode); + void foldLevel(int level, bool mode); void foldAll(bool mode); - void fold(size_t line, bool mode); + void fold(size_t line, bool mode, bool shouldBeNotified = true); bool isFolded(size_t line) const { return (execute(SCI_GETFOLDEXPANDED, line) != 0); }; + void expand(size_t& line, bool doExpand, bool force = false, intptr_t visLevels = 0, intptr_t level = -1); + bool isCurrentLineFolded() const; void foldCurrentPos(bool mode); int getCodepage() const {return _codepage;}; @@ -810,34 +813,14 @@ public: void styleChange(); void hideLines(); - - 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); + bool hidelineMarkerClicked(intptr_t lineNumber); //true if it did something + void notifyHidelineMarkers(Buffer * buf, bool isHide, size_t location, bool del); + void hideMarkedLines(size_t searchStart, bool endOfDoc); + void showHiddenLines(size_t searchStart, bool endOfDoc, bool doDelete); void restoreHiddenLines(); bool hasSelection() const { return !execute(SCI_GETSELECTIONEMPTY); }; - bool isSelecting() const { - static Sci_CharacterRangeFull previousSelRange = getSelection(); - Sci_CharacterRangeFull currentSelRange = getSelection(); - - if (currentSelRange.cpMin == currentSelRange.cpMax) - { - previousSelRange = currentSelRange; - return false; - } - - if ((previousSelRange.cpMin == currentSelRange.cpMin) || (previousSelRange.cpMax == currentSelRange.cpMax)) - { - previousSelRange = currentSelRange; - return true; - } - - previousSelRange = currentSelRange; - return false; - }; - bool isPythonStyleIndentation(LangType typeDoc) const{ return (typeDoc == L_PYTHON || typeDoc == L_COFFEESCRIPT || typeDoc == L_HASKELL ||\ typeDoc == L_C || typeDoc == L_CPP || typeDoc == L_OBJC || typeDoc == L_CS || typeDoc == L_JAVA ||\ diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index cff644529..5849eec8d 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -293,7 +293,7 @@ void DocumentMap::doMove() void DocumentMap::fold(size_t line, bool foldOrNot) { - _pMapView->fold(line, foldOrNot); + _pMapView->fold(line, foldOrNot, false); } void DocumentMap::foldAll(bool mode)