diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 368f3e020..ed04f7860 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2192,7 +2192,7 @@ void Notepad_plus::command(int id) case IDM_VIEW_UNFOLD_CURRENT: { bool isToggleEnabled = NppParameters::getInstance().getNppGUI()._enableFoldCmdToggable; - bool mode = id == IDM_VIEW_FOLD_CURRENT ? fold_collapse : fold_uncollapse; + bool mode = id == IDM_VIEW_FOLD_CURRENT ? folding_fold : folding_unfold; intptr_t headerLine = _pEditView->getHeaderLine(); if (headerLine != -1) @@ -2200,7 +2200,7 @@ void Notepad_plus::command(int id) if (isToggleEnabled) { bool isFolded = _pEditView->isCurrentLineFolded(headerLine); - mode = isFolded ? fold_uncollapse : fold_collapse; + mode = isFolded ? folding_unfold : folding_fold; } _pEditView->foldCurrentPos(headerLine, mode); @@ -2212,11 +2212,11 @@ void Notepad_plus::command(int id) case IDM_VIEW_UNFOLDALL: { _isFolding = true; // So we can ignore events while folding is taking place - bool doCollapse = (id==IDM_VIEW_FOLDALL)?fold_collapse:fold_uncollapse; - _pEditView->foldAll(doCollapse); + bool doFold = (id == IDM_VIEW_FOLDALL) ? folding_fold : folding_unfold; + _pEditView->foldAll(doFold); if (_pDocMap) { - _pDocMap->foldAll(doCollapse); + _pDocMap->foldAll(doFold); } _isFolding = false; } @@ -2231,7 +2231,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->collapse(id - IDM_VIEW_FOLD - 1, folding_fold); _isFolding = false; break; @@ -2244,7 +2244,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_uncollapse); + _pEditView->collapse(id - IDM_VIEW_UNFOLD - 1, folding_unfold); _isFolding = false; break; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 34d4f29bf..15557dfe7 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.collapse(searchHeaderLevel - SC_FOLDLEVELBASE, folding_fold); } void Finder::finishFilesSearch(int count, int searchedCount, bool searchedEntireNotSelection, const FindOption* pFindOpt) @@ -5720,13 +5720,13 @@ intptr_t CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam case NPPM_INTERNAL_SCINTILLAFINDERCOLLAPSE : { - _scintView.foldAll(fold_collapse, false); + _scintView.foldAll(folding_fold, false); return TRUE; } case NPPM_INTERNAL_SCINTILLAFINDERUNCOLLAPSE : { - _scintView.foldAll(fold_uncollapse, false); + _scintView.foldAll(folding_unfold, false); return TRUE; } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index ba300eb2c..adf552c59 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -2480,7 +2480,7 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) if (mask & BufferChangeLanguage) { defineDocType(buffer->getLangType()); - foldAll(fold_uncollapse); + foldAll(folding_unfold); } if (mask & BufferChangeLexing) @@ -2554,16 +2554,16 @@ struct FoldLevelStack } -intptr_t ScintillaEditView::getHeaderLine(intptr_t currentLine/* = -1*/) const noexcept +intptr_t ScintillaEditView::getHeaderLine(intptr_t line/* = -1*/) const noexcept { - auto currentLine2 = (currentLine == -1) ? getCurrentLineNumber() : currentLine; + auto l = (line == -1) ? getCurrentLineNumber() : line; intptr_t headerLine; - auto level = execute(SCI_GETFOLDLEVEL, currentLine2); + auto level = execute(SCI_GETFOLDLEVEL, l); if (level & SC_FOLDLEVELHEADERFLAG) - headerLine = currentLine2; + headerLine = l; else - headerLine = execute(SCI_GETFOLDPARENT, currentLine2); + headerLine = execute(SCI_GETFOLDPARENT, l); return headerLine; } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 40f5dd4d9..da147b3f5 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -89,9 +89,8 @@ const int CP_GREEK = 1253; #define LIST_7 128 #define LIST_8 256 -const size_t fold_toggle = SC_FOLDACTION_TOGGLE; -const bool fold_uncollapse = true; -const bool fold_collapse = false; +const bool folding_unfold = true; +const bool folding_fold = false; #define MAX_FOLD_COLLAPSE_LEVEL 8 #define MODEVENTMASK_OFF 0 @@ -781,7 +780,7 @@ public: }; bool isFoldIndentationBased() const; - intptr_t getHeaderLine(intptr_t currentLine = -1) const noexcept; + intptr_t getHeaderLine(intptr_t line = -1) const noexcept; void collapseFoldIndentationBased(int level2Collapse, bool mode); void collapse(int level2Collapse, bool mode); void foldAll(size_t mode, bool isNotify = true);