summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2022-05-30 10:37:19 +0200
committerDaniel Lange <DLange@git.local>2022-05-30 10:37:19 +0200
commitce5009532392692ffe4ce6b394b63ca82ba4686b (patch)
tree0bbebdb8b552e62925fd3303be1d9444d834b72c
parent7694dbc82175baff3b3a42898ef8c29c7299eca3 (diff)
parent17e28d5264c34075bdd4b5ebf2b7c0efb892ce2f (diff)
Merge branch 'fix-allBranchesCollapsed' of tanriol/htop
-rw-r--r--Action.c3
-rw-r--r--ProcessList.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/Action.c b/Action.c
index 551c426b..b7652487 100644
--- a/Action.c
+++ b/Action.c
@@ -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);
diff --git a/ProcessList.c b/ProcessList.c
index fcc77a5f..bbaddd86 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -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);

© 2014-2024 Faster IT GmbH | imprint | privacy policy