mirror of https://github.com/xzeldon/htop.git
Merge branch 'fix-allBranchesCollapsed' of tanriol/htop
This commit is contained in:
commit
ce50095323
3
Action.c
3
Action.c
|
@ -242,6 +242,9 @@ static Htop_Reaction actionToggleTreeView(State* st) {
|
||||||
|
|
||||||
static Htop_Reaction actionExpandOrCollapseAllBranches(State* st) {
|
static Htop_Reaction actionExpandOrCollapseAllBranches(State* st) {
|
||||||
ScreenSettings* ss = st->settings->ss;
|
ScreenSettings* ss = st->settings->ss;
|
||||||
|
if (!ss->treeView) {
|
||||||
|
return HTOP_OK;
|
||||||
|
}
|
||||||
ss->allBranchesCollapsed = !ss->allBranchesCollapsed;
|
ss->allBranchesCollapsed = !ss->allBranchesCollapsed;
|
||||||
if (ss->allBranchesCollapsed)
|
if (ss->allBranchesCollapsed)
|
||||||
ProcessList_collapseAllBranches(st->pl);
|
ProcessList_collapseAllBranches(st->pl);
|
||||||
|
|
|
@ -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) {
|
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