Invert Process_compare resolution so that superclass matches run first

* This removes duplicated code that adjusts the sort direction from every
  OS-specific folder.
* Most fields in a regular htop screen are OS-independent, so trying
  Process_compare first and only falling back to the OS-specific
  compareByKey function if it's an OS-specific field makes sense.
* This will allow us to override the sortKey in a global way without having
  to edit each OS-specific file.
This commit is contained in:
Hisham Muhammad
2020-12-17 20:09:55 -03:00
committed by BenBE
parent 52fa4e7ee4
commit 3d1703f16f
10 changed files with 51 additions and 90 deletions

View File

@ -555,6 +555,6 @@ long Process_compare(const void* v1, const void* v2) {
case USER:
return SPACESHIP_NULLSTR(p1->user, p2->user);
default:
return SPACESHIP_NUMBER(p1->pid, p2->pid);
return Process_compareByKey(p1, p2, key);
}
}