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 /Process.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 'Process.c')
-rw-r--r-- | Process.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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; +} |