mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-13 12:44:34 +03:00
Linux: dynamically adjust the SECATTR column width
SELinux contexts can be quite long; adjust the column width dynamically at each cycle to the longest value. Also with the recent addition of multiple screens, over-long columns can be moved into their own screen.
This commit is contained in:

committed by
BenBE

parent
6133cac721
commit
3ba695293c
20
Process.c
20
Process.c
@ -1252,3 +1252,23 @@ void Process_updateExe(Process* this, const char* exe) {
|
||||
}
|
||||
this->mergedCommand.exeChanged = true;
|
||||
}
|
||||
|
||||
uint8_t Process_fieldWidths[LAST_PROCESSFIELD] = { 0 };
|
||||
|
||||
void Process_resetFieldWidths() {
|
||||
for (size_t i = 0; i < LAST_PROCESSFIELD; i++) {
|
||||
if (!Process_fields[i].autoWidth)
|
||||
continue;
|
||||
|
||||
size_t len = strlen(Process_fields[i].title);
|
||||
assert(len <= UINT8_MAX);
|
||||
Process_fieldWidths[i] = (uint8_t)len;
|
||||
}
|
||||
}
|
||||
|
||||
void Process_updateFieldWidth(ProcessField key, size_t width) {
|
||||
if (width > UINT8_MAX)
|
||||
Process_fieldWidths[key] = UINT8_MAX;
|
||||
else if (width > Process_fieldWidths[key])
|
||||
Process_fieldWidths[key] = (uint8_t)width;
|
||||
}
|
||||
|
Reference in New Issue
Block a user