From 3ba695293c981af034d243605a30dac6cb55f880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sat, 4 Dec 2021 19:57:47 +0100 Subject: 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. --- ProcessList.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ProcessList.c') 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; -- cgit v1.2.3