Option and key ("*") to collapse / expand all branches under PID 1

(and PID 2 if kernel threads are shown)

Based on hishamhm/htop#510 by Krishna Chaitanya, B
Closes #68
This commit is contained in:
Daniel Lange
2021-02-12 18:48:09 +01:00
parent c44b2ec795
commit 2c6222e30a
8 changed files with 36 additions and 3 deletions

View File

@ -494,6 +494,16 @@ void ProcessList_expandTree(ProcessList* this) {
}
}
void ProcessList_collapseAllBranches(ProcessList* this) {
int size = Vector_size(this->processes);
for (int i = 0; i < size; i++) {
Process* process = (Process*) Vector_get(this->processes, i);
// FreeBSD has pid 0 = kernel and pid 1 = init, so init has tree_depth = 1
if (process->tree_depth > 0 && process->pid > 1)
process->showChildren = false;
}
}
void ProcessList_rebuildPanel(ProcessList* this) {
const char* incFilter = this->incFilter;