Add "Tree view is always sorted by PID" option to mimic htop 2 behavior

This commit is contained in:
Hisham Muhammad
2020-12-17 19:08:56 -03:00
committed by BenBE
parent 3d1703f16f
commit e8c6994f40
7 changed files with 30 additions and 6 deletions

View File

@ -505,7 +505,12 @@ long Process_compare(const void* v1, const void* v2) {
p1 = (const Process*)v2;
}
switch (settings->sortKey) {
ProcessField key = settings->sortKey;
if (settings->treeView && settings->treeViewAlwaysByPID) {
key = PID;
}
switch (key) {
case PERCENT_CPU:
case PERCENT_NORM_CPU:
return SPACESHIP_NUMBER(p2->percent_cpu, p1->percent_cpu);