mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 21:14:35 +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
@ -114,6 +114,12 @@ static const char* alignedProcessFieldTitle(const ProcessList* this, ProcessFiel
|
||||
return titleBuffer;
|
||||
}
|
||||
|
||||
if (Process_fields[field].autoWidth) {
|
||||
static char titleBuffer[UINT8_MAX + 1];
|
||||
xSnprintf(titleBuffer, sizeof(titleBuffer), "%-*.*s ", Process_fieldWidths[field], Process_fieldWidths[field], title);
|
||||
return titleBuffer;
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
@ -453,6 +459,7 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) {
|
||||
this->kernelThreads = 0;
|
||||
this->runningTasks = 0;
|
||||
|
||||
Process_resetFieldWidths();
|
||||
|
||||
// set scan timestamp
|
||||
static bool firstScanDone = false;
|
||||
|
Reference in New Issue
Block a user