Skip to content

Commit

Permalink
Merge branch 'fix-allBranchesCollapsed' of tanriol/htop
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lange authored and Daniel Lange committed May 30, 2022
2 parents 7694dbc + 17e28d5 commit ce50095
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Action.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ static Htop_Reaction actionToggleTreeView(State* st) {

static Htop_Reaction actionExpandOrCollapseAllBranches(State* st) {
ScreenSettings* ss = st->settings->ss;
if (!ss->treeView) {
return HTOP_OK;
}
ss->allBranchesCollapsed = !ss->allBranchesCollapsed;
if (ss->allBranchesCollapsed)
ProcessList_collapseAllBranches(st->pl);
Expand Down
3 changes: 3 additions & 0 deletions ProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,10 @@ void ProcessList_expandTree(ProcessList* this) {
}
}

// Called on collapse-all toggle and on startup, possibly in non-tree mode
void ProcessList_collapseAllBranches(ProcessList* this) {
ProcessList_buildTree(this); // Update `tree_depth` fields of the processes
this->needsSort = true; // ProcessList is sorted by parent now, force new sort
int size = Vector_size(this->processes);
for (int i = 0; i < size; i++) {
Process* process = (Process*) Vector_get(this->processes, i);
Expand Down

0 comments on commit ce50095

Please sign in to comment.