diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-12-04 19:57:47 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-03-06 19:56:25 +0100 |
commit | 3ba695293c981af034d243605a30dac6cb55f880 (patch) | |
tree | 5c09f11bfbe34680f52b86cc00f2225bd45615b9 /ProcessList.c | |
parent | 6133cac721f355aec0d6b5581fef90db34305f29 (diff) |
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.
Diffstat (limited to 'ProcessList.c')
-rw-r--r-- | ProcessList.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ProcessList.c b/ProcessList.c index f6ba63fd..f3e184e8 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -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; |