mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Ability to change sort column with the mouse by
clicking column titles (click again to invert order). Also, add a consolidated IO kbyte/s column.
This commit is contained in:
@ -286,7 +286,7 @@ RichString ProcessList_printHeader(ProcessList* this) {
|
||||
RichString_initVal(out);
|
||||
ProcessField* fields = this->fields;
|
||||
for (int i = 0; fields[i]; i++) {
|
||||
char* field = Process_printField(fields[i]);
|
||||
char* field = Process_fieldTitles[fields[i]];
|
||||
if (this->sortKey == fields[i])
|
||||
RichString_append(&out, CRT_colors[PANEL_HIGHLIGHT_FOCUS], field);
|
||||
else
|
||||
@ -816,3 +816,17 @@ void ProcessList_scan(ProcessList* this) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ProcessField ProcessList_keyAt(ProcessList* this, int at) {
|
||||
int x = 0;
|
||||
ProcessField* fields = this->fields;
|
||||
ProcessField field;
|
||||
for (int i = 0; (field = fields[i]); i++) {
|
||||
int len = strlen(Process_fieldTitles[field]);
|
||||
if (at >= x && at <= x + len) {
|
||||
return field;
|
||||
}
|
||||
x += len;
|
||||
}
|
||||
return COMM;
|
||||
}
|
||||
|
Reference in New Issue
Block a user