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:
Christian Göttsche
2021-12-04 19:57:47 +01:00
committed by BenBE
parent 6133cac721
commit 3ba695293c
5 changed files with 39 additions and 2 deletions

View File

@ -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;