mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Separate tree and list sort orders
Implements the suggestion from https://github.com/htop-dev/htop/issues/399#issuecomment-747861013 Thanks to the refactors from 0bd5c8fb5da and 6393baa74e5, this was really easy and clean to do. It maintains the "Tree view always by PID" option in the Settings, which results in some specific behaviors such as "clicking on the column header to exit tree view" and "picking a new sort order to exit tree view", for the sake of the muscle memory of long time htop users. :)
This commit is contained in:
@ -497,7 +497,7 @@ long Process_compare(const void* v1, const void* v2) {
|
||||
const Settings *settings = ((const Process*)v1)->settings;
|
||||
int r;
|
||||
|
||||
if (settings->direction == 1) {
|
||||
if (Settings_getActiveDirection(settings) == 1) {
|
||||
p1 = (const Process*)v1;
|
||||
p2 = (const Process*)v2;
|
||||
} else {
|
||||
@ -505,10 +505,7 @@ long Process_compare(const void* v1, const void* v2) {
|
||||
p1 = (const Process*)v2;
|
||||
}
|
||||
|
||||
ProcessField key = settings->sortKey;
|
||||
if (settings->treeView && settings->treeViewAlwaysByPID) {
|
||||
key = PID;
|
||||
}
|
||||
ProcessField key = Settings_getActiveSortKey(settings);
|
||||
|
||||
switch (key) {
|
||||
case PERCENT_CPU:
|
||||
|
Reference in New Issue
Block a user