mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-25 15:25:45 +00:00
ProcessList_collapseAllBranches: actually build tree
As the loop checks `tree_depth`, a tree build is needed to ensure they're filled in correctly. Note that this breaks the display list sort order in case it's non-tree-based (either startup in flat mode, or `*` hotkey in flat mode), so the display list will need to be sorted again.
This commit is contained in:
parent
d73cc70566
commit
da97d2625a
@ -353,7 +353,10 @@ void ProcessList_expandTree(ProcessList* this) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called on collapse-all toggle and on startup, possibly in non-tree mode
|
||||||
void ProcessList_collapseAllBranches(ProcessList* this) {
|
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);
|
int size = Vector_size(this->processes);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
Process* process = (Process*) Vector_get(this->processes, i);
|
Process* process = (Process*) Vector_get(this->processes, i);
|
||||||
|
Loading…
Reference in New Issue
Block a user