Change some variable names

This commit is contained in:
Don Ho 2025-02-10 23:06:32 +01:00
parent 6e9a323bc0
commit f88437600c
4 changed files with 19 additions and 20 deletions

View File

@ -2192,7 +2192,7 @@ void Notepad_plus::command(int id)
case IDM_VIEW_UNFOLD_CURRENT: case IDM_VIEW_UNFOLD_CURRENT:
{ {
bool isToggleEnabled = NppParameters::getInstance().getNppGUI()._enableFoldCmdToggable; 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(); intptr_t headerLine = _pEditView->getHeaderLine();
if (headerLine != -1) if (headerLine != -1)
@ -2200,7 +2200,7 @@ void Notepad_plus::command(int id)
if (isToggleEnabled) if (isToggleEnabled)
{ {
bool isFolded = _pEditView->isCurrentLineFolded(headerLine); bool isFolded = _pEditView->isCurrentLineFolded(headerLine);
mode = isFolded ? fold_uncollapse : fold_collapse; mode = isFolded ? folding_unfold : folding_fold;
} }
_pEditView->foldCurrentPos(headerLine, mode); _pEditView->foldCurrentPos(headerLine, mode);
@ -2212,11 +2212,11 @@ void Notepad_plus::command(int id)
case IDM_VIEW_UNFOLDALL: case IDM_VIEW_UNFOLDALL:
{ {
_isFolding = true; // So we can ignore events while folding is taking place _isFolding = true; // So we can ignore events while folding is taking place
bool doCollapse = (id==IDM_VIEW_FOLDALL)?fold_collapse:fold_uncollapse; bool doFold = (id == IDM_VIEW_FOLDALL) ? folding_fold : folding_unfold;
_pEditView->foldAll(doCollapse); _pEditView->foldAll(doFold);
if (_pDocMap) if (_pDocMap)
{ {
_pDocMap->foldAll(doCollapse); _pDocMap->foldAll(doFold);
} }
_isFolding = false; _isFolding = false;
} }
@ -2231,7 +2231,7 @@ void Notepad_plus::command(int id)
case IDM_VIEW_FOLD_7: case IDM_VIEW_FOLD_7:
case IDM_VIEW_FOLD_8: case IDM_VIEW_FOLD_8:
_isFolding = true; // So we can ignore events while folding is taking place _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; _isFolding = false;
break; break;
@ -2244,7 +2244,7 @@ void Notepad_plus::command(int id)
case IDM_VIEW_UNFOLD_7: case IDM_VIEW_UNFOLD_7:
case IDM_VIEW_UNFOLD_8: case IDM_VIEW_UNFOLD_8:
_isFolding = true; // So we can ignore events while folding is taking place _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; _isFolding = false;
break; break;

View File

@ -5581,7 +5581,7 @@ void Finder::beginNewFilesSearch()
_nbFoundFiles = 0; _nbFoundFiles = 0;
// fold all old searches (1st level only) // 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) 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 : case NPPM_INTERNAL_SCINTILLAFINDERCOLLAPSE :
{ {
_scintView.foldAll(fold_collapse, false); _scintView.foldAll(folding_fold, false);
return TRUE; return TRUE;
} }
case NPPM_INTERNAL_SCINTILLAFINDERUNCOLLAPSE : case NPPM_INTERNAL_SCINTILLAFINDERUNCOLLAPSE :
{ {
_scintView.foldAll(fold_uncollapse, false); _scintView.foldAll(folding_unfold, false);
return TRUE; return TRUE;
} }

View File

@ -2480,7 +2480,7 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask)
if (mask & BufferChangeLanguage) if (mask & BufferChangeLanguage)
{ {
defineDocType(buffer->getLangType()); defineDocType(buffer->getLangType());
foldAll(fold_uncollapse); foldAll(folding_unfold);
} }
if (mask & BufferChangeLexing) 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; intptr_t headerLine;
auto level = execute(SCI_GETFOLDLEVEL, currentLine2); auto level = execute(SCI_GETFOLDLEVEL, l);
if (level & SC_FOLDLEVELHEADERFLAG) if (level & SC_FOLDLEVELHEADERFLAG)
headerLine = currentLine2; headerLine = l;
else else
headerLine = execute(SCI_GETFOLDPARENT, currentLine2); headerLine = execute(SCI_GETFOLDPARENT, l);
return headerLine; return headerLine;
} }

View File

@ -89,9 +89,8 @@ const int CP_GREEK = 1253;
#define LIST_7 128 #define LIST_7 128
#define LIST_8 256 #define LIST_8 256
const size_t fold_toggle = SC_FOLDACTION_TOGGLE; const bool folding_unfold = true;
const bool fold_uncollapse = true; const bool folding_fold = false;
const bool fold_collapse = false;
#define MAX_FOLD_COLLAPSE_LEVEL 8 #define MAX_FOLD_COLLAPSE_LEVEL 8
#define MODEVENTMASK_OFF 0 #define MODEVENTMASK_OFF 0
@ -781,7 +780,7 @@ public:
}; };
bool isFoldIndentationBased() const; 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 collapseFoldIndentationBased(int level2Collapse, bool mode);
void collapse(int level2Collapse, bool mode); void collapse(int level2Collapse, bool mode);
void foldAll(size_t mode, bool isNotify = true); void foldAll(size_t mode, bool isNotify = true);